-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(client): use process_output and process_multiple_input #1794
Conversation
`neqo_transport::Connection` offers 4 process methods: - `process` - `process_output` - `process_input` - `process_multiple_input` Where `process` is a wrapper around `process_input` and `process_output` calling both in sequence. https://github.com/mozilla/neqo/blob/5dfe106669ccb695187511305c21b8e8a8775e91/neqo-transport/src/connection/mod.rs#L1099-L1107 Where `process_input` delegates to `process_multiple_input`. https://github.com/mozilla/neqo/blob/5dfe106669ccb695187511305c21b8e8a8775e91/neqo-transport/src/connection/mod.rs#L979-L1000 Previously `neqo-client` would use `process` only. Thus continuously interleaving output and input. Say `neqo-client` would have multiple datagrams buffered through a GRO read, it could potentially have to do a write in between each `process` calls, as each call to `process` with an input datagram might return an output datagram to be written. With this commit `neqo-client` uses `process_output` and `process_multiple_input` directly, thus reducing interleaving on batch reads (GRO and in the future recvmmsg) and in the future batch writes (GSO and sendmmsg). By using `process_multiple_input` instead of `process` or `process_input`, auxiliarry logic, like `self.cleanup_closed_streams` only has to run per input datagram batch, and not for each input datagram. Extracted from mozilla#1741.
b859582
to
e32cf8b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1794 +/- ##
==========================================
- Coverage 93.12% 93.12% -0.01%
==========================================
Files 116 116
Lines 36097 36095 -2
==========================================
- Hits 33614 33612 -2
Misses 2483 2483 ☔ View full report in Codecov by Sentry. |
3816bab
to
431885a
Compare
Benchmark resultsPerformance differences relative to 5dfe106.
Client/server transfer resultsTransfer of 134217728 bytes over loopback.
|
Regression here should be addressed once #1795 is merged. Today, That said, when benchmarking
|
Client | Server | CC | Pacing | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|---|---|---|
msquic | msquic | 693.3 ± 256.7 | 448.7 | 1287.7 | 1.00 | ||
neqo | msquic | reno | on | 2229.4 ± 316.3 | 1904.6 | 2694.4 | 1.00 |
neqo | msquic | reno | 2075.1 ± 203.2 | 1876.3 | 2442.8 | 1.00 | |
neqo | msquic | cubic | on | 2053.5 ± 254.7 | 1818.8 | 2554.8 | 1.00 |
neqo | msquic | cubic | 2037.2 ± 205.5 | 1881.1 | 2441.2 | 1.00 |
https://github.com/mozilla/neqo/actions/runs/8565335284
client-process-input
(this) branch
Client | Server | CC | Pacing | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|---|---|---|
msquic | msquic | 746.9 ± 307.5 | 381.0 | 1345.0 | 1.00 | ||
neqo | msquic | reno | on | 1141.7 ± 342.0 | 780.7 | 1792.2 | 1.00 |
neqo | msquic | reno | 1075.2 ± 200.6 | 845.8 | 1411.5 | 1.00 | |
neqo | msquic | cubic | on | 1042.5 ± 213.0 | 816.5 | 1386.7 | 1.00 |
neqo | msquic | cubic | 1002.9 ± 176.0 | 787.5 | 1208.7 | 1.00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to refactor http09.rs
and http3.rs
to further reduce code duplication in process_output
and process_multiple_input
?
Yes. I have a couple of ideas. Thought not directly related to this pull request.
What duplication are you referring to @larseggert? The |
Can we have one one-liner? :-) |
I think I am missing something. How would that be possible? Long term I have in mind for there to be a single fn process<'a>(&mut self, input: impl Iterator<Item = &'a Datagram>, output: impl Iterator<Item = &'a mut Datagram>, now: Instant) -> Option<Duration> See #1693 for a rough overview. |
There are two server implementations based on neqo: 1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server - http3 and http09 implementation - used for manual testing and QUIC Interop 2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs - used to test Firefox I assume one was once an exact copy of the other. Both implement their own I/O, event loop, ... Since then, the two implementations diverged significantly. Especially (1) saw a lot of improvements in recent months: - mozilla#1564 - mozilla#1569 - mozilla#1578 - mozilla#1581 - mozilla#1604 - mozilla#1612 - mozilla#1676 - mozilla#1692 - mozilla#1707 - mozilla#1708 - mozilla#1727 - mozilla#1753 - mozilla#1756 - mozilla#1766 - mozilla#1772 - mozilla#1786 - mozilla#1787 - mozilla#1788 - mozilla#1794 - mozilla#1806 - mozilla#1808 - mozilla#1848 - mozilla#1866 At this point, bugs in (2) are hard to fix, see e.g. mozilla#1801. This commit merges (2) into (1), thus removing all duplicate logic and having (2) benefit from all the recent improvements to (1).
There are two server implementations based on neqo: 1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server - http3 and http09 implementation - used for manual testing and QUIC Interop 2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs - used to test Firefox I assume one was once an exact copy of the other. Both implement their own I/O, event loop, ... Since then, the two implementations diverged significantly. Especially (1) saw a lot of improvements in recent months: - mozilla#1564 - mozilla#1569 - mozilla#1578 - mozilla#1581 - mozilla#1604 - mozilla#1612 - mozilla#1676 - mozilla#1692 - mozilla#1707 - mozilla#1708 - mozilla#1727 - mozilla#1753 - mozilla#1756 - mozilla#1766 - mozilla#1772 - mozilla#1786 - mozilla#1787 - mozilla#1788 - mozilla#1794 - mozilla#1806 - mozilla#1808 - mozilla#1848 - mozilla#1866 At this point, bugs in (2) are hard to fix, see e.g. mozilla#1801. This commit merges (2) into (1), thus removing all duplicate logic and having (2) benefit from all the recent improvements to (1).
* refactor(bin): introduce server/http3.rs and server/http09.rs The QUIC Interop Runner requires an http3 and http09 implementation for both client and server. The client code is already structured into an http3 and an http09 implementation since #1727. This commit does the same for the server side, i.e. splits the http3 and http09 implementation into separate Rust modules. * refactor: merge mozilla-central http3 server into neqo-bin There are two server implementations based on neqo: 1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server - http3 and http09 implementation - used for manual testing and QUIC Interop 2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs - used to test Firefox I assume one was once an exact copy of the other. Both implement their own I/O, event loop, ... Since then, the two implementations diverged significantly. Especially (1) saw a lot of improvements in recent months: - #1564 - #1569 - #1578 - #1581 - #1604 - #1612 - #1676 - #1692 - #1707 - #1708 - #1727 - #1753 - #1756 - #1766 - #1772 - #1786 - #1787 - #1788 - #1794 - #1806 - #1808 - #1848 - #1866 At this point, bugs in (2) are hard to fix, see e.g. #1801. This commit merges (2) into (1), thus removing all duplicate logic and having (2) benefit from all the recent improvements to (1). * Move firefox.rs to mozilla-central * Reduce HttpServer trait functions * Extract constructor * Remove unused deps * Remove clap color feature Nice to have. Adds multiple dependencies. Hard to justify for mozilla-central.
neqo_transport::Connection
offers 4 process methods:process
process_output
process_input
process_multiple_input
Where
process
is a wrapper aroundprocess_input
andprocess_output
calling both in sequence.neqo/neqo-transport/src/connection/mod.rs
Lines 1099 to 1107 in 5dfe106
Where
process_input
delegates toprocess_multiple_input
.neqo/neqo-transport/src/connection/mod.rs
Lines 979 to 1000 in 5dfe106
Previously
neqo-client
would useprocess
only. Thus continuously interleaving output and input. Sayneqo-client
would have multiple datagrams buffered through a GRO read, it could potentially have to do a write in between eachprocess
calls, as each call toprocess
with an input datagram might return an output datagram to be written.With this commit
neqo-client
usesprocess_output
andprocess_multiple_input
directly, thus reducing interleaving on batch reads (GRO and in the future recvmmsg) and in the future batch writes (GSO and sendmmsg).By using
process_multiple_input
instead ofprocess
orprocess_input
, auxiliarry logic, likeself.cleanup_closed_streams
only has to run per input datagram batch, and not for each input datagram.Extracted from #1741.