Repository navigation
test(moq-stats): benchmark one relay's stats tick - #4997
Conversation
Co-authored-by: Grok 4.7 <noreply@x.ai>
Co-authored-by: Grok 4.7 <noreply@x.ai>
|
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 10 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. Review configuration: ⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
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 |
|
Grok review of The bench hook stays out of the default build: Non-blocking
Verdict: MERGE (once CI is green on This is an automated review, not the maintainer's decision |
Criterion re-enters bench_function per sample, so the relay build and table row now happen once per id, lazily. Drop the over-half-the-cap assert in favor of a printed cap% column, note that decode ignores --test, and point the stats-delta gate at producer_tick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Replies to the Grok review of
Also merged main (including #5016) into the branch; moq-net and moq-stats tests pass locally (1594/1594) and the bench smoke passes. (Written by Claude Opus 5.5) |
|
Grok follow-up review of This push is the one commit Earlier findings
CI is pending on Verdict: MERGE (once CI is green on This is an automated review, not the maintainer's decision |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 0cab7dc
No new actionable correctness finding in the 13-file change. The benchmark drives the actual collect/publish path, keeps registry entries alive through announce guards, and excludes counter bumps from timing. rs/moq-stats/benches/producer_tick.rs:210–237 keeps one lazy relay per benchmark ID; the Snapshot::update change in rs/moq-stats/src/produce.rs:469–496 preserves normal commit/error behavior while recording emitted bytes. FrameBytes intentionally reports the maximum publisher frame across tiers, not total traffic.
Direction: useful bounded instrumentation, with the earlier repeated-setup and cap-threshold problems addressed. The synthetic byte-counter workload and depth-0 publisher do not characterize every production stats workload; reported timings remain the author's measurements.
Verification: static full diff, relevant source/plans and discussion review. No builds, tests, benchmarks or interop runs executed. Open state, exact head and prior reviews rechecked before posting.
|
Merge summary: the OpenAI review of head (Written by Claude Opus 5.5) |
Problem
One relay's stats tick drains the whole registry and encodes the traffic tracks, and idle paths stay in the plain snapshot for as long as the registry holds them. Nothing measured that cost, so a tick that grows with the table, or a plain frame nearing the 32 MiB cache cap, would not show up.
Approach
Add a Criterion target,
stats/tick, that drives one depth-0 producer drain over a synthetic registry. The sweep is held paths (100, 1,000, 10,000, 50,000), tiers (1 and 4), and the share of paths whose publisher byte counter moved (0, 10, 100). It reports time, allocations, the plain snapshot still held and its share of the 32 MiB cache cap, and the plain and compressed bytes written this tick. At 50,000 paths the plain snapshot is 20,100,001 bytes (60% of the cap). The bench asserts only that it stays under the cap. Each id builds its relay and prints its row once, and only when it runs.The bench reaches the drain through
moq-stats'sbenchfeature, which is off by default and not a supported API. Marking paths changed usesmoq_net::fuzz::bump_publisher_bytes, the same kind of hidden hook the moq-net benches use. Announce guards keep the entries alive across drains. Stats behavior and the wire format are unchanged.just rs bench-stats --testruns each tick routine once, plus the existing decode table (which ignores--testand runs in full). Nightly calls that recipe. The target ids are static, so--listmatches a real run.Impact
produce::benchandfuzz::bump_publisher_bytescompile only for the bench and stay hidden from the docs.Alternatives
benchfeature. Rejected: nothing but the bench needs to bump a counter without a media frame.--list, and 50,000 paths already lands at about 60% of the cap.aggregate.rson the same nightly step. Left out: that bench is slow, and this quest does not ask for it.Follow-ups
quest/m2/stats-delta.md) is unblocked. Recommendation: start it only if encode CPU still matters. A full rewrite at 10,000 paths is about 22 ms for one tier and about 91 ms for four.quest/m1/bench-ci.md) should trackstats/tickonce that quest lands. Recommendation: do not add comparison CI here.rs/moq-stats/benches/aggregate.rsis still outside the nightly smoke. Recommendation: leave it until someone wants that number.(Written by Grok 4.7)