refactor!: improve path events around path closing#427
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/quinn/pr/427/docs/iroh_quinn/ Last updated: 2026-02-20T16:11:31Z |
0f40834 to
4993dd2
Compare
Performance Comparison Report
|
| Scenario | iroh-quinn | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5310.8 Mbps | 7954.5 Mbps | -33.2% | 92.9% / 97.9% |
| medium-concurrent | 5406.4 Mbps | 7762.8 Mbps | -30.4% | 98.8% / 157.0% |
| medium-single | 3875.2 Mbps | 4654.8 Mbps | -16.7% | 95.3% / 106.0% |
| small-concurrent | 3802.1 Mbps | 5278.0 Mbps | -28.0% | 96.5% / 107.0% |
| small-single | 3531.3 Mbps | 4771.1 Mbps | -26.0% | 91.9% / 108.0% |
Netsim Benchmarks (network simulation)
| Condition | iroh-quinn | upstream | Delta |
|---|---|---|---|
| ideal | 2892.6 Mbps | 3988.5 Mbps | -27.5% |
| lan | 777.3 Mbps | 804.6 Mbps | -3.4% |
| wan | 83.8 Mbps | 83.8 Mbps | ~0% |
Summary
iroh-quinn is 27.2% slower on average
06ecf1ebdd5e05cff8a9ab6f5a48685466208f6d - artifacts
Raw Benchmarks (localhost)
| Scenario | iroh-quinn | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5474.9 Mbps | 7873.7 Mbps | -30.5% | 96.0% / 104.0% |
| medium-concurrent | 5481.6 Mbps | 7802.6 Mbps | -29.7% | 94.8% / 104.0% |
| medium-single | 3585.2 Mbps | 4790.8 Mbps | -25.2% | 89.4% / 97.2% |
| small-concurrent | 3802.5 Mbps | 4957.3 Mbps | -23.3% | 90.4% / 98.5% |
| small-single | 3475.2 Mbps | 4877.4 Mbps | -28.7% | 94.9% / 105.0% |
Netsim Benchmarks (network simulation)
| Condition | iroh-quinn | upstream | Delta |
|---|---|---|---|
| ideal | 2990.6 Mbps | N/A | N/A |
| lan | 782.5 Mbps | N/A | N/A |
| lossy | 69.9 Mbps | N/A | N/A |
| wan | 83.8 Mbps | N/A | N/A |
Summary
iroh-quinn is 28.0% slower on average
30a21403f5c2b1b32dc185d59fe32161b72518b9 - artifacts
Raw Benchmarks (localhost)
| Scenario | iroh-quinn | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5455.9 Mbps | 8199.2 Mbps | -33.5% | 99.4% / 157.0% |
| medium-concurrent | 5455.1 Mbps | 7671.0 Mbps | -28.9% | 98.5% / 157.0% |
| medium-single | 4259.9 Mbps | 4704.2 Mbps | -9.4% | 94.0% / 107.0% |
| small-concurrent | 3722.5 Mbps | 5010.7 Mbps | -25.7% | 96.1% / 107.0% |
| small-single | 3438.5 Mbps | 4377.8 Mbps | -21.5% | 90.6% / 98.2% |
Netsim Benchmarks (network simulation)
| Condition | iroh-quinn | upstream | Delta |
|---|---|---|---|
| ideal | 2955.5 Mbps | 3995.1 Mbps | -26.0% |
| lan | 782.5 Mbps | 810.4 Mbps | -3.4% |
| lossy | 69.9 Mbps | 55.9 Mbps | +25.0% |
| wan | 83.8 Mbps | 83.8 Mbps | ~0% |
Summary
iroh-quinn is 24.9% slower on average
7f9a648c4237e10e4c8e1c21eb2c3ca406e4a7ad - artifacts
Raw Benchmarks (localhost)
| Scenario | iroh-quinn | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5415.5 Mbps | 7966.4 Mbps | -32.0% | 93.8% / 103.0% |
| medium-concurrent | 5372.0 Mbps | 7728.9 Mbps | -30.5% | 91.5% / 96.8% |
| medium-single | 3918.3 Mbps | 4748.8 Mbps | -17.5% | 84.9% / 94.6% |
| small-concurrent | 3591.2 Mbps | 5314.3 Mbps | -32.4% | 93.6% / 102.0% |
| small-single | 3320.3 Mbps | 4699.7 Mbps | -29.3% | 86.9% / 96.5% |
Netsim Benchmarks (network simulation)
| Condition | iroh-quinn | upstream | Delta |
|---|---|---|---|
| ideal | 3142.6 Mbps | N/A | N/A |
| lan | 782.4 Mbps | N/A | N/A |
| lossy | 69.8 Mbps | N/A | N/A |
| wan | 83.8 Mbps | N/A | N/A |
Summary
iroh-quinn is 29.0% slower on average
28465115d579e52c66cb525f91a7bb9310e35d57 - artifacts
Raw Benchmarks (localhost)
| Scenario | iroh-quinn | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5337.8 Mbps | 7901.8 Mbps | -32.4% | 93.8% / 123.0% |
| medium-concurrent | 5499.5 Mbps | 7957.9 Mbps | -30.9% | 92.9% / 97.4% |
| medium-single | 3827.7 Mbps | 4749.0 Mbps | -19.4% | 94.0% / 126.0% |
| small-concurrent | 3728.3 Mbps | 4954.3 Mbps | -24.7% | 92.2% / 99.4% |
| small-single | 3285.1 Mbps | 4828.3 Mbps | -32.0% | 93.8% / 128.0% |
Netsim Benchmarks (network simulation)
| Condition | iroh-quinn | upstream | Delta |
|---|---|---|---|
| ideal | 3002.6 Mbps | N/A | N/A |
| lan | 782.4 Mbps | N/A | N/A |
| lossy | 69.9 Mbps | N/A | N/A |
| wan | 83.8 Mbps | N/A | N/A |
Summary
iroh-quinn is 28.7% slower on average
4993dd2 to
34fd5a7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #427 +/- ##
==========================================
+ Coverage 77.38% 77.43% +0.05%
==========================================
Files 81 81
Lines 23360 23366 +6
==========================================
+ Hits 18076 18093 +17
+ Misses 5284 5273 -11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
quinn-proto/src/connection/paths.rs
Outdated
| TimedOut, | ||
| /// The path became unusable after a local network change. | ||
| UnusableAfterNetworkChange, | ||
| /// The path was opened in a NAT traversal round which was superseded by a new round. |
There was a problem hiding this comment.
| /// The path was opened in a NAT traversal round which was superseded by a new round. | |
| /// The path was opened in a NAT traversal round which was ended. |
I'm not sure if it is correct to say that a round can not end before another one can start.
quinn/src/connection.rs
Outdated
| self.path_events.send(evt.clone()).ok(); | ||
| Path(ref evt @ PathEvent::Abandoned { id, .. }) => { | ||
| if let Some(sender) = self.open_path.remove(&id) { | ||
| // TODO(frando): |
There was a problem hiding this comment.
Why is this a todo? Can it ever be resolved?
There was a problem hiding this comment.
No, I don't think this needs to be resolved further. The TODO is a leftover from before I wrote the lengthy comment. I think it's OK as-is. Removed the TODO.
flub
left a comment
There was a problem hiding this comment.
Oops, lost track of this for a few days. Apologies.
To me this is good. Though I think @divagant-martian still had some reservations about exposing abandoned and discarded as separate events. Personally I'm fine with both events though. If someone doesn't care about the discard they can just ignore it.
divagant-martian
left a comment
There was a problem hiding this comment.
I'm now convinced
Description
Fixes #421
This changes the events that are emitted from quinn_proto, and quinn, for when paths become closed.
What on current
mainisPathEvent::Abandonedhas been renamed toPathEvent::Discarded, because this event was and is emitted not when the path is abandoned (i.e. becomes no longer usable) but when the path was discarded (i.e. all state for the path is cleared, and the path stats become final and will no longer change).A new
PathEvent::Abandonedis added which replaces both the now-removedPathEvent::LocallyClosedand thePathEvent::Closedwhich was removed in #419.The new
PathEvent::Abandonedcontains aPathAbandonReasonenum, which contains cases for the various reasons why a path may be closed from the local side, plus aRemoteAbandonedvariant if the remote closed the path.Internally, some logic that was previously spread out is now unified into this enum as well.
Breaking Changes
quinn_proto::PathEvent::LocallyClosedquinn_proto::PathEvent::Abandonedtoquinn_proto::PathEvent::Discardedquinn_proto::PathEvent::AbandonedNotes & open questions
We could add distinct events for when a not-yet-opened path is abandoned, and for when a already-opened path has been abandoned. I'm not sure if it's worth it though, the difference would be minor.