-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement
RelayDatagramsQueue
(#2998)
Based on #2986 ## Description <!-- A summary of what this pull request achieves and a rough list of changes. --> Replaces `RelayRecvReceiver` and `RelayRecvSender` with the (clonable & shared) `RelayDatagramsQueue`. This queue contains a `ConcurrentQueue` (from the smol library `concurrent-queue`) and an `AtomicWaker`. It should only be polled from one task. If polled from multiple tasks, then tasks will overwrite each other's wakers. Unfortunately we can't make it use `&mut Self` in `poll_recv` because `quinn` expects the `AsyncUdpSocket`s `poll_recv` interface to be `&self`. This (un)fortunately doesn't have an effect on performance for me. (The benchmark is completely broken half the time for some reason, but when it runs it produces normal numbers:) ```sh $ DEV_RELAY_ONLY=true cargo run -p iroh-net-bench --release --features=local-relay -- iroh --with-relay --download-size=100M │ Throughput │ Duration ──────┼───────────────┼────────── AVG │ 55.05 MiB/s │ 1.82s P0 │ 55.03 MiB/s │ 1.82s P10 │ 55.06 MiB/s │ 1.82s P50 │ 55.06 MiB/s │ 1.82s P90 │ 55.06 MiB/s │ 1.82s P100 │ 55.06 MiB/s │ 1.82s ``` And basically exactly the same times for the PR this is based on. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Todo - [x] Rename variables to e.g. `relay_datagrams_queue` instead of `relay_recv_sender` or `relay_recv_channel` etc. - [x] Add documentation about multiple tasks polling, etc. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented.
- Loading branch information
Showing
4 changed files
with
144 additions
and
68 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters