Repository navigation
bench(net): backport session_fanout_threads to release - #7698
Conversation
Ports main's session_fanout_threads case (#7493) into release's single-file session bench, under main's case IDs, so the pre-cut pairing compares the fanout contention fix. Adds a process CPU clock and a multi-threaded runtime to the bench only; no shipped code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 283a1bb
- P2 — Keep the multithreaded Tokio feature off wasm (
rs/moq-net/Cargo.toml:39–62): The unconditional dev-dependency enablesrt-multi-threadforwasm32-unknown-unknown, which Tokio rejects at compile time. This breaks the existing documentedcargo test --test wasm -p moq-net --target wasm32-unknown-unknownpath. Make that feature a non-wasm target-specific dev-dependency and gate the threaded benchmark as needed.
Backporting the benchmark is a reasonable way to compare releases; target-scoping the runtime feature keeps the change focused. Static review only; I did not run the benchmark or tests.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — bench-only backport of main's session_fanout_threads case onto release, hand-ported into release's single-file bench layout; no shipped code, public API, or wire changes.
- Multi-threaded runtime:
threaded(workers)builds anew_multi_threadruntime;rt-multi-threadadded to moq-net's tokio dev features. - Process-CPU clock:
Clock { Wall, Process }andMeasurementClock { Wall, Cpu }ported without main'sThreadvariant orSESSION_CPUplumbing;Roomgains aclockfield defaulted toWall, so every other case still times elapsed time. fanout_threadscase: 1 publisher / 64 viewers / 400-byte one-frame groups, registered incriterion_group!, early-returning off Unix and underSESSION_ALLOCS/SESSION_EXPIRY_ONLY.libc: added as acfg(unix)dev-dependency;Cargo.lockgains only moq-net's edge.
Verified locally: cargo check -p moq-net --bench session --locked is clean, and cargo test -p moq-net --bench session -- --test session_fanout_threads runs all four cases ({moq-lite-06,moq-lite-07-wip}/workers={1,16}), Success, exit 0. The case IDs match main's fanout_threads::<Model> (Model::PREFIX = ""), so the just bench origin/release pairing compares like for like.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
moq-dev#7695) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Ports
main'ssession_fanout_threadscase from moq-dev/moq#7493 ontorelease, so the pre-cut pairing (just bench origin/release, run frommain) can compare #7493's contention fix. This is a bench-only backport underCONTRIBUTING.md's rule (moq-dev/moq#7581). It finishes what moq-dev/moq#7586 left for later. The quest PR is moq-dev/moq#7695.Changes
On
mainthe case lives in the splitsession/mod.rs, which doesn't build onrelease. So it's ported by hand intorelease's single-filers/moq-net/benches/session.rs:fanout_threads:main's function, minus theBackendtype parameter (releasehas only the model relay, andModel::PREFIXis""). Same shape (1 publisher, 64 viewers, 400-byte one-frame groups) and the same case IDs:session_fanout_threads/{moq-lite-06,moq-lite-07-wip}/workers={1,16}.threaded(workers):main's multi-threaded runtime builder.ClockandMeasurementClock:main's round clock, reduced toWallandProcess.releasehas noSESSION_CPUthread-CPU mode, so theThreadvariant is left out.Roomgains aclockfield,Wallby default, so every other case still times elapsed time exactly as before.main'ssession_fanout_threadsparagraph.rs/moq-net/Cargo.toml: tokio'srt-multi-threaddev feature, andlibcas a Unix-only dev-dependency, as onmain.Cargo.lockgains only moq-net'slibcedge.No shipped code changes. Public API: none. Wire: none.
Notes
rs/**, so release-plz will propose a patch bump for moq-net, though only benchmark code changed. I bumped no versions.Verification
All on
release(338cb9b3e8) plus this change, Linux:cargo test --locked -p moq-net --bench session(Criterion's test mode) passes all 318 cases, including the 4 new ones.cargo benchrun (--warm-up-time 1 --measurement-time 3) ofsession_fanout_threadsmeasured 1.89 ms (moq-lite-06) and 1.80 ms (moq-lite-07-wip) of process CPU per round atworkers=1, against 2.75 ms and 2.55 ms atworkers=16. Those are the contention costs perf(moq-net): fanout subscribers stop contending the shared track lock #7493 removes onmain.cargo clippy --locked -p moq-net --benches -- -D warningsis clean, with and without--features fuzz. So arecargo fmt --all -- --check,cargo sort --workspace --check, andcargo shear.cargo sortalso warns aboutmoq-cliandmoq-tokio, but those warnings are already onrelease, and this PR doesn't touch either file.main's source (rs/moq-net/benches/session/mod.rs,fanout_threads), whose group name is{PREFIX}session_fanout_threadswithModel::PREFIX = "", and whose rows are{version}/workers={workers}.Review
Codex (
gpt-6.1-sol, medium effort) ran a localquest review --base origin/release, round 1, on head283a1bba417ed2173ae24d9b33a57478c86fd0b6. It reported no findings.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)