Repository navigation
perf(net): share route ranking across announcement cursors - #4634
Conversation
Co-Authored-By: GPT-6 <noreply@openai.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 28 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
kixelated
left a comment
There was a problem hiding this comment.
Reviewed for equivalence with sync_cursor; no findings.
- A non-empty
presentedonly arises whenprefixsits strictly under the cursor root, soroot.join(presented) == prefixand everyroutes.at(prefix)entry shares one length. The old longest-prefix filter was a no-op there, and "first visible inroute_order" equals the old per-cursormin_by_keyover visible entries. route_orderends inReverse(entry.id), so the order is total andsort_unstable_by_keycannot change a winner on ties.- The root case still goes through
sync_cursor, which keeps the covering-prefix collapse, androot_cursor_keeps_the_more_specific_covering_routepins it.
This is the duplicates x cursors axis the .stats mesh loads on every edge, so moq.pro wants to pin it as soon as it lands.
(Written by Claude Opus 5.5)
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 41e3c31ef7d53edcc4db6ac9131e7dfd9c0542d2
No actionable bugs found. I independently confirmed the existing equivalence review. The delivery helper is an unchanged extraction apart from its receiver.
Direction: keep the pass-local ranking. It avoids repeated ranking-key computation without persistent-index bookkeeping, while preserving per-cursor visibility and the covering-root fallback. Sorting costs O(R log R), and worst-case visibility scanning remains O(R × C); the sparse/fanout controls and scoped repricing benchmark appropriately exercise the tradeoff. No public API or wire change.
Verification: static review of the full diff and surrounding selection/delivery paths, new regression tests, and nightly benchmark wiring. I did not run builds, tests, or benchmarks or reproduce the reported performance figures. CI is still running.
(Written by an OpenAI model)
Problem
sync_routerecomputes the minimum visible route independently for every interested announcement cursor. Duplicate routes at one prefix multiply route ranking work by cursor fanout. Live relay profiles showed this path consuming substantial CPU during mesh announcement churn.Approach
Rank routes at the changed prefix once, then let each cursor choose its first visible candidate. Preserve scope, split-horizon, hidden and mount filtering. Keep the existing covering-route selection for cursor roots, where multiple prefixes collapse into one presentation. Extract winner delivery into
TableCursor::updateso both paths share notification behavior.Add scope/split-horizon and covering-root regression coverage, sparse fanout controls, and a scoped route-repricing benchmark.
Impact
Validation
just fixandjust checkpassed on committed head41e3c31efagainstorigin/main. The main Nextest suite passed 4,835 tests; transport and media feature suites passed another 367, 132 and 73 test executions. Linting, drill applicability and Nix checks also passed.Serial Criterion comparison against d04baef, 20 samples per case with 1 second warmup and measurement, on the same shared Linux host:
All sampled sparse and fleet cases also improved. These are synthetic shared-host measurements, not a demonstrated reduction in production packet loss. The benchmark is covered by the existing nightly origin benchmark smoke run.
Alternatives
Reusing one winner globally would break per-cursor visibility. Persistent sorted state adds mutation bookkeeping; this change keeps ranking local to one synchronization pass.
Follow-ups
Measure production CPU and UDP drops after this lands and is deployed separately. This PR does not change fleet pins or deploy anything. Related planning: #4615.
(Written by GPT-6)