refactor(noq)!: open path by four tuple and replace open_path_ensure with OpenPathOpts#655
Open
Frando wants to merge 2 commits into
Open
refactor(noq)!: open path by four tuple and replace open_path_ensure with OpenPathOpts#655Frando wants to merge 2 commits into
Frando wants to merge 2 commits into
Conversation
4 tasks
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/noq/pr/655/docs/noq/ Last updated: 2026-05-14T15:37:59Z |
14f50b3 to
9a5b2f4
Compare
Performance Comparison Report
|
| Condition | noq | upstream | Delta |
|---|---|---|---|
| ideal | 3178.2 Mbps | 4148.9 Mbps | -23.4% |
| lan | 782.4 Mbps | 810.3 Mbps | -3.4% |
Summary
noq is 20.1% slower on average
9a5b2f4db5b525860d40e8e243b4016872d11af5 - artifacts
Raw Benchmarks (localhost)
| Scenario | noq | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5551.1 Mbps | 8016.4 Mbps | -30.8% | 96.7% / 98.4% |
| medium-concurrent | 5516.9 Mbps | 7641.7 Mbps | -27.8% | 96.2% / 97.8% |
| medium-single | 4158.8 Mbps | 4749.3 Mbps | -12.4% | 96.1% / 98.0% |
| small-concurrent | 3919.3 Mbps | 5296.0 Mbps | -26.0% | 97.8% / 99.8% |
| small-single | 3564.1 Mbps | 4771.6 Mbps | -25.3% | 96.1% / 98.3% |
Netsim Benchmarks (network simulation)
| Condition | noq | upstream | Delta |
|---|---|---|---|
| ideal | 3088.4 Mbps | 3984.9 Mbps | -22.5% |
| lan | 782.4 Mbps | 810.3 Mbps | -3.4% |
| lossy | 69.8 Mbps | 55.9 Mbps | +25.0% |
| wan | 83.8 Mbps | 83.8 Mbps | ~0% |
Summary
noq is 24.5% slower on average
335b7b8921e6f345aa63e594371f3d6658f25dc2 - artifacts
Raw Benchmarks (localhost)
| Scenario | noq | upstream | Delta | CPU (avg/max) |
|---|---|---|---|---|
| large-single | 5458.4 Mbps | 8068.0 Mbps | -32.3% | 95.1% / 146.0% |
| medium-concurrent | 5337.5 Mbps | 7722.3 Mbps | -30.9% | 95.7% / 147.0% |
| medium-single | 4327.6 Mbps | 4748.9 Mbps | -8.9% | 98.3% / 149.0% |
| small-concurrent | 3881.8 Mbps | 5226.0 Mbps | -25.7% | 94.3% / 102.0% |
| small-single | 3476.5 Mbps | 4822.1 Mbps | -27.9% | 93.7% / 102.0% |
Netsim Benchmarks (network simulation)
| Condition | noq | upstream | Delta |
|---|---|---|---|
| ideal | 3048.8 Mbps | 4022.9 Mbps | -24.2% |
| lan | 782.4 Mbps | 810.4 Mbps | -3.4% |
| lossy | 69.9 Mbps | 69.8 Mbps | ~0% |
| wan | 83.8 Mbps | 83.8 Mbps | ~0% |
Summary
noq is 25.6% slower on average
9a5b2f4 to
335b7b8
Compare
flub
reviewed
May 15, 2026
| #[derive(Debug, Copy, Clone, Default)] | ||
| pub struct OpenPathOpts { | ||
| pub(crate) initial_status: PathStatus, | ||
| pub(crate) allow_duplicate: bool, |
Collaborator
There was a problem hiding this comment.
did you have a motivation to have to keep this option?
Member
Author
There was a problem hiding this comment.
- in
handle_network_change, when opening replacement paths for non-recoverable paths, I currently setallow_duplicates(true). Reason: The replacement path wouldn't be opened otherwise, because we cleared the local_ip beforehand on all paths. - Not a justification, but a reason in the initial PR: We need it in the noq test suite, because otherwise we couldn't open multiple paths over localhost reliably, which we do in the noq multipath tests.
Do you think it should be removed?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replaced #653
Improve the APIs to open paths on both
noqandnoq-proto.Connection::open_pathnow takes aFourTuple(allowing the caller to specifylocal_ip) instead of a bareSocketAddrremote.open_path_ensureis removed. Its duplicate-path semantics now live insideopen_path, with a newOpenPathOpts::allow_duplicateflag (defaultfalse). When a path with a matching 4-tuple already exists,open_pathreturns the newPathError::PathExistsForNetworkPath(PathId).initial_statusargument is replaced withOpenPathOpts, which carriesinitial_statusandallow_duplicate. We can add more fields without breaking changes this way too.noq::Connection::open_pathnow returnsResult<OpenPath, PathError>. Thus immediate errors are surfaced at the call site instead of deferring them to the returned future.OpenPathbecomes a struct instead of an enum, and we can use a oneshot instead of a watch channel nowBreaking Changes
noq_proto::Connection::open_pathnow takes(FourTuple, OpenPathOpts, Instant), with the initial_status being set on the OpenPathOptsnoq_proto::Connection::open_path_ensure. Useopen_pathwith
OpenPathOpts::default()(returnsPathExistsForNetworkPathwhen a matching path exists) or
OpenPathOpts::default().allow_duplicate(true).noq::Connection::open_pathsignature is now(FourTuple, OpenPathOpts) -> Result<OpenPath, PathError>.noq::Connection::open_path_ensure: removed. useopen_pathwithOpenPathOpts::default().allow_duplicates(true)insteadnoq::OpenPath::path_id: returnsPathIdinstead ofOption<PathId>.Change checklist