Skip to content

feat(moq-net): sans-IO session benchmark over a relay mesh - #4160

Merged
kixelated merged 5 commits into
mainfrom
quest/m1/bench-session
Sep 26, 2026
Merged

kixelated merged 5 commits into
mainfrom
quest/m1/bench-session

Conversation

@kixelated

@kixelated kixelated commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Nothing benchmarks a full publisher -> relay -> viewer path, so costs that grow with announced routes, viewers, or cluster size go unmeasured.

Approach

rs/moq-net/benches/session.rs runs publishing clients, a full mesh of relays (peered like moq-relay's cluster: each side publishes its whole origin, hidden included, and subscribes into it), and viewing clients over the existing in-memory mock transport, on one current-thread runtime. Lite 07 and IETF 22.

  • session_delivery_*: one round (every watched broadcast writes a 4-frame group, every viewer reads one per subscription), sweeping publishers, viewers, both together, broadcasts per publisher (mostly unwatched), broadcasts per viewer, frame size, and relays.
  • session_join_*: a new viewer connecting, resolving, and receiving its latest group, swept over announced broadcasts and relays.
  • Each origin has its own bounded cache pool (16 MiB per relay, 1 MiB per client); the default unbounded pool grows memory with run length.
  • Test support: MockConnectOptions publish fields take an origin::Consumer, so a peer can publish a hidden-inclusive view.

Profiling (perf, frame pointers) found four follow-ups, filed as quests with their numbers:

Finding Evidence
Lite subscriber polls every announced route per wake lite delivery 445 us at 16 announced, 15.2 ms at 4096; IETF flat. 57% CPU in WaiterList::register
Lite announce replay is quadratic lite join 199 us / 517 us / 8.9 ms at 1 / 64 / 1024 announced
IETF RSS grows past the 30 s cache expiry with the default pool 3.5 GB at 30 s, 4.9 GB at 50 s
~32 us fixed cost per viewer-group spread over waiter registration, eviction scan, waker allocation, malloc

Relay mesh size is healthy: delivery 1.45 -> 1.6 ms from 1 to 8 relays.

Impact

  • No public API or wire change. Test support and a new bench target only.

Alternatives

  • Driving moq-relay itself: needs a transport seam; tracked by the Relay session bench quest.

Follow-ups

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

@kixelated
kixelated marked this pull request as ready for review September 25, 2026 17:18
@kixelated

Copy link
Copy Markdown
Collaborator Author

Local just check: lint, format, and moq-net's 1251 tests pass. The one failure, moq-tokio watch::tests::bare_filename_watches_current_dir, is "Too many open files" from the host's inotify instance limit (128, all in use by other agents on the machine); this PR doesn't touch moq-tokio. Bench timings in the description come from a low-load run; the machine hit load 89 later, which inflated a second pass 5-20x, so treat the absolute numbers as indicative and the slopes as the finding.

(Written by Claude Opus 5.5)

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9519e342-04cf-410c-95c1-cd1c5014059d

📥 Commits

Reviewing files that changed from the base of the PR and between 1f2e40c and d300ece.

📒 Files selected for processing (18)
  • quest/m1/README.md
  • quest/m1/bench-ci.md
  • quest/m1/bench-relay.md
  • quest/m1/bench-session.md
  • quest/m1/cache-expiry-growth.md
  • quest/m1/perf/README.md
  • quest/m1/perf/announce-replay.md
  • quest/m1/perf/group-cost.md
  • quest/m1/perf/lite-route-rescan.md
  • rs/moq-net/Cargo.toml
  • rs/moq-net/benches/session.rs
  • rs/moq-net/tests/announce_to_serve.rs
  • rs/moq-net/tests/datagram.rs
  • rs/moq-net/tests/finished_broadcast_mock.rs
  • rs/moq-net/tests/goaway.rs
  • rs/moq-net/tests/rejoin.rs
  • rs/moq-net/tests/support/harness.rs
  • rs/moq-net/tests/track_tail.rs
💤 Files with no reviewable changes (2)
  • quest/m1/bench-ci.md
  • quest/m1/bench-session.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


Walkthrough

The change adds a Criterion benchmark suite for MoQ session delivery and viewer joins across two protocol versions. It adds quest documents for cache expiry, announcement replay, route rescanning, and group relay cost. It removes the previous session benchmark planning document and updates related quest links. Mock tests now pass consumed publisher origins through harness options typed as origin consumers.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to d300e

The benchmark, quest updates, and mock-origin changes have no established issue requiring a fix before merge; normal checks remain appropriate.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 8 files. (8 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: a moq-net session benchmark over a relay mesh. It is concise and related to the benchmark implementation.
Description check ✅ Passed The description directly explains the benchmark purpose, approach, measured scenarios, profiling findings, and follow-up quests. It is fully related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 45.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 8 files. (8 skipped: 8 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-09-25T23:19:36.670329Z d300ece New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 882342b918

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-net/benches/session.rs Outdated
Comment thread rs/moq-net/benches/session.rs Outdated
kixelated and others added 5 commits September 25, 2026 16:13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the session bench

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moq-lite-07 no longer parses. Mock publish options take a Consumer, so track_tail consumes like the other harness tests.
@kixelated
kixelated force-pushed the quest/m1/bench-session branch from a08325c to d300ece Compare September 25, 2026 23:18

Copy link
Copy Markdown
Collaborator Author

Rebased onto current main. The red Check and Test were the moq-ffi E0283 (config.into()), already fixed on main, so this does not cherry-pick #4171.

Landing the sans-IO session benchmark over a relay mesh: publishers, a full relay mesh, and viewers on the in-memory transport. No public API or wire change. After the rebase, the bench parses moq-lite-07-wip (plain moq-lite-07 no longer does) and track_tail passes a Consumer into the mock publish option, matching the harness.

(Written by Grok 4.7)

@kixelated
kixelated enabled auto-merge (squash) September 25, 2026 23:30
@kixelated
kixelated merged commit 9cb5416 into main Sep 26, 2026
6 checks passed
@kixelated
kixelated deleted the quest/m1/bench-session branch September 26, 2026 00:00
@moq-bot moq-bot Bot mentioned this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant