Skip to content

refactor(tests): Introduce ConnPairBuilder#680

Merged
flub merged 9 commits into
mainfrom
flub/conn-pair-builder
Jun 1, 2026
Merged

refactor(tests): Introduce ConnPairBuilder#680
flub merged 9 commits into
mainfrom
flub/conn-pair-builder

Conversation

@flub
Copy link
Copy Markdown
Collaborator

@flub flub commented May 29, 2026

Description

This introduces a ConnPairBuilder to construct the ConnPair and
switches everything over to use it. The individual ConnPair
construction methods were becoming unwieldy.

There are probably a few style arguments to be had, but the current
code doesn't look to bad. We can keep tweaking this.

Breaking Changes

none

Notes & open questions

split off from #675 and taken a bit further.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.

This introduces a ConnPairBuilder to construct the ConnPair and
switches everything over to use it. The individual ConnPair
construction methods were becoming unwieldy.

There are probably a few style arguments to be had, but the current
code doesn't look to bad. We can keep tweaking this.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

Performance Comparison Report

51b05398c6bedd44f274d0d528416d32da212b41 - artifacts

No results available

---
202950d5ea21a7faf436475efc8bc50710c8fe68 - artifacts

Raw Benchmarks (localhost)

Scenario noq upstream Delta CPU (avg/max)
large-single 5903.3 Mbps 7951.1 Mbps -25.8% 97.1% / 98.7%
medium-concurrent 5226.9 Mbps 7744.3 Mbps -32.5% 95.9% / 97.8%
medium-single 4094.6 Mbps 4646.0 Mbps -11.9% 96.2% / 98.7%
small-concurrent 3880.4 Mbps 5267.0 Mbps -26.3% 97.4% / 99.7%
small-single 3547.6 Mbps 4746.4 Mbps -25.3% 96.7% / 99.0%

Netsim Benchmarks (network simulation)

Condition noq upstream Delta
ideal 3113.5 Mbps 3933.9 Mbps -20.9%
lan 782.3 Mbps 810.4 Mbps -3.5%
lossy 69.8 Mbps 69.8 Mbps ~0%
wan 83.8 Mbps 83.8 Mbps ~0%

Summary

noq is 24.3% slower on average

---
1d921bc97e67988149ee102723582dbddf1ad218 - artifacts

No results available

---
e283b37d1bfd75df832221a410a04309a6092570 - artifacts

No results available

---
22737663afd31cd23fe32bd9a3d9583fc3cedc8c - artifacts

No results available

---
5f4a15567d3ad809bbd8f9802e7194e2529a76a8 - artifacts

Netsim Benchmarks (network simulation)

Condition noq upstream Delta
ideal 3079.6 Mbps 3968.4 Mbps -22.4%

Summary

noq is 22.4% slower on average

---
3d66e03e956da1c66feb79e5ea2fb162f71ecfbd - artifacts

No results available

---
f127b4660d8264a4a82e953c911052f6ce26b025 - artifacts

Raw Benchmarks (localhost)

Scenario noq upstream Delta CPU (avg/max)
large-single 5717.4 Mbps 7746.0 Mbps -26.2% 93.0% / 98.0%
medium-concurrent 5763.7 Mbps 7351.7 Mbps -21.6% 95.6% / 102.0%
medium-single 3816.3 Mbps 4749.4 Mbps -19.6% 94.3% / 102.0%
small-concurrent 3967.9 Mbps 5389.5 Mbps -26.4% 99.6% / 153.0%
small-single 3551.0 Mbps 4836.7 Mbps -26.6% 98.2% / 151.0%

Netsim Benchmarks (network simulation)

Condition noq upstream Delta
ideal 3114.2 Mbps N/A N/A
lan 782.4 Mbps N/A N/A
lossy 65.5 Mbps N/A N/A
wan 83.8 Mbps N/A N/A

Summary

noq is 24.1% slower on average

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/noq/pr/680/docs/noq/

Last updated: 2026-06-01T11:57:39Z

@n0bot n0bot Bot added this to iroh May 29, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh May 29, 2026
Copy link
Copy Markdown
Collaborator

@divagant-martian divagant-martian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments :)

Comment thread noq-proto/src/tests/util.rs Outdated
Comment thread noq-proto/src/tests/util.rs Outdated
Comment thread noq-proto/src/tests/multipath.rs Outdated
Comment on lines +1473 to +1480
let mut builder = ConnPair::builder().with_multipath();
builder
.server_transport_cfg
.max_concurrent_multipath_paths(6);
builder
.client_transport_cfg
.max_concurrent_multipath_paths(6);
let mut pair = builder.connect();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let mut builder = ConnPair::builder().with_multipath();
builder
.server_transport_cfg
.max_concurrent_multipath_paths(6);
builder
.client_transport_cfg
.max_concurrent_multipath_paths(6);
let mut pair = builder.connect();
let mut cfg = TransportConfig::default();
cfg.max_concurrent_multipath_paths(6);
let mut pair = ConnPair::builder().with_transport_cfg(cfg).connect();

The with_multipath I think is not doing anything followed by updating the number of paths for both

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The big difference is that ConnPairBuilder::default does initialise the TransportConfig with more than just TransportConfig::default(). This is kind of why I ended up making the ConnpPairBuilder::server_transport_cfg fields public because it was more convenient to extend this pattern of extending the default-for-tests TransportConfig.

Writing this down another nice way could be to have TransportConfig::default_for_test constructor. And than you could do the pattern you suggest here easily. Would folks prefer that? The bit that slightly discourages me from that is that the default_for_test code would live in a file far away from the test code.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, i could change this test to expect 8 max concurrent paths. In a way that would make more sense to be honest. I think 6 is fairly arbitrary.

Comment thread noq-proto/src/tests/util.rs Outdated
}

/// Sets an [`EndpointConfig`] for only the server.
pub(super) fn with_server_endpoint_config(mut self, cfg: EndpointConfig) -> Self {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use consistent naming for the config/cfg sufixed methods?

Copy link
Copy Markdown
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally in favor of this

Comment thread noq-proto/src/tests/multipath.rs
@flub
Copy link
Copy Markdown
Collaborator Author

flub commented Jun 1, 2026

PTAL: the major change is changing the builder methods that took no argument into enable/disable instead of with/without. Which is probably a little more consistent.

Copy link
Copy Markdown
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still happy with it. Even better!

@flub flub enabled auto-merge June 1, 2026 11:59
@flub flub added this pull request to the merge queue Jun 1, 2026
Merged via the queue into main with commit 33dba68 Jun 1, 2026
39 checks passed
@flub flub deleted the flub/conn-pair-builder branch June 1, 2026 12:08
@github-project-automation github-project-automation Bot moved this from 🚑 Needs Triage to ✅ Done in iroh Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants