Repository navigation
bench(net): sweep equal-cost pool resolution and churn - #4607
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds origin/pool_resolve and origin/pool_churn, each swept over pool members against the paths the pool already serves, and completes the pool-bench quest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uest/m0/wildcard/pool-bench
|
Outcome: both sweeps landed, Open decisions:
(Written by Claude Opus 5.5) |
|
Decision: this PR goes ahead as the benchmark only. The pool churn fix (waking only the fronts a route change can affect) will be planned as a separate quest and stays out of this PR. Marking ready for review. (Written by Claude Opus 5.5) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
(Written by OpenAI)
Reviewed moq-dev/moq at bf70b23108fc4ca85dea80285ca906723160b549.
No actionable bugs found. The public-API resolution sweep keeps existing fronts alive and retires each refused probe outside timing (origin.rs:435-477); the churn sweep drives join and leave separately and checks that pinned fronts do not migrate (489-514). Pool size and served-path count vary independently, and the existing nightly all-bench smoke includes these routines.
Direction: keep this benchmark-only. Measuring the public path avoids exporting private routing internals, and separating the churn optimization preserves a useful baseline without extra production complexity. No API or wire change.
Limits: source review only; I did not run benchmarks or tests, or independently reproduce the reported timings. Nightly smoke checks execution, not performance thresholds.
Completes
quest/m0/wildcard/pool-bench.md, a child of the wildcard line (#4403).Problem
#4279 keyed
route_order's tie-break on the requested path, so resolving a path scans the equal-cost pool and hashes the path with every member's hops. Only a correctness test covered it; AGENTS.md asks for a two-axis sweep for anything that fans out.Approach
Two groups in
rs/moq-net/benches/origin.rs, each swept over pool members (4, 32, 256) x paths the pool already serves (100, 1k, 10k):origin/pool_resolve: one new path resolved through the public API, fromrequest_broadcastto the chosen member holding the request. The member refuses it untimed so every iteration mints a fresh front.origin/pool_churn: one member joining then leaving the pool. Every front under the prefix re-selects on both changes, so this is paths x members by design. An untimed check asserts no front moves to the newcomer.Both are compiled by the PR gate (
clippy --all-targets) and run once by the nightlymoq-net benchmark smoke.Results
About 15 agents shared a 32-core machine (load average ~50) while these ran, so absolute numbers are noisy by up to 2x between runs. Read the slopes, not the values.
pool_resolve(per request):best_routecheck and the front's selection). Irrelevant at realistic pool sizes, and paid once per front, not per subscriber.WeakCacheGCs ended fronts). The 10k column's rise is cache pressure plus noise; reruns of 256m gave 58/102/104 µs.pool_churn(per join + leave):This matters: a single worker joining or leaving a pool that serves 10k paths costs a relay's origin driver 100 to 300 ms of single-threaded work, even though no front can switch to the newcomer (a pinned front only accepts its own publisher). Not optimized here per the quest; proposed as a follow-up below.
Impact
Alternatives
best_routedirectly (as the unit test does) would isolate the scan, but a bench cannot reach it without exporting it, and the public path is what a relay pays.Front::admitonly returns an origin once a lite-07 copy's reply names one, so it needs mock sessions (thesessionbench harness), and the session round trip would swamp the O(tracks) walk at small counts. Left as a follow-up.Follow-ups
run_front, over lite-07 mock sessions.Checks
just checkpasses.cargo bench -p moq-net --bench origin -- pool --testpasses.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)