Skip to content
Merged
6 changes: 6 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ slow-timeout = { period = "60s" }
filter = "package(moq-tokio) & test(=receive_credit::benchmark_receive_windows)"
slow-timeout = { period = "60s", terminate-after = 5 }

# The datagram benchmark publishes in real time and drains the bottleneck's backlog,
# per version and offered load.
[[profile.default.overrides]]
filter = "package(moq-tokio) & test(=datagram_delivery::benchmark_datagram_delivery)"
slow-timeout = { period = "60s", terminate-after = 3 }

[test-groups]
io-uring = { max-threads = 4 }
v4l2 = { max-threads = 1 }
Expand Down
31 changes: 31 additions & 0 deletions bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,37 @@ SUBSCRIBE use uni data streams. No sleep supplies backpressure. Every case
checks complete payload delivery. Compare paired runs with identical settings
and disclose host load; CPU timing still depends on hardware contention.

Measure datagram delivery the same way, over publishers and viewers, payload
size, and cadence (datagrams per track between reads):

```bash
nix develop --command cargo bench --locked -p moq-net --features fuzz --bench session -- session_delivery_datagram
nix develop --command env SESSION_ALLOCS=1 cargo bench --locked -p moq-net --features fuzz --bench session -- session_delivery
```

Throughput counts delivered datagrams. Every one must arrive with its sequence
and payload; the memory transport loses none at these cadences, so a drop fails
instead of looking cheaper. `SESSION_ALLOCS=1` prints allocations, allocated
bytes and, where Linux perf counters are readable, user instructions per
delivered datagram or viewer-group. All three exclude the cache tick. Bytes sum
requested allocation and reallocation sizes, including growth in place; they
measure neither live memory nor bytes copied. A multiplexed instruction counter
fails the run instead of reporting an undercount. Every task runs on the bench's
one thread. Pin it to one CPU to compare repeated instruction counts. The relay target runs the same shapes as
`relay_session_delivery_datagram`.

Real QUIC adds congestion control and the sender's datagram queue. This sends
datagrams below and above a bufferbloated bottleneck to a loopback viewer and a
throttled one:

```bash
nix develop --command just rs test -p moq-tokio --release -E 'test(benchmark_datagram_delivery)' --run-ignored only --success-output immediate
```

It reports offered, received and lost datagrams, bottleneck queue drops, reordered
arrivals and append-to-receive latency per viewer, and fails if the loopback
viewer loses any. It runs nightly.

Measure 50 fps audio at per-packet, 100 and 200 ms grouping, plus 400 fps
(2.5 ms packets) at per-packet and the 20 ms default. Frames are 200 bytes:

Expand Down
28 changes: 13 additions & 15 deletions quest/m2/audit-perf.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,36 +163,34 @@ follow-up quest. The m1 run added none of these:
1. [HLS request fan-out](/quest/m2/performance-survey/hls-serving.md) owns
repeated segment fetch/remux and playlist rendering, swept over viewers,
renditions and window segments.
2. [Session datagrams](/quest/m2/performance-survey/datagram-delivery.md) owns
complete adapter delivery across publishers and viewers.
3. LOC and CMAF wire containers in moq-mux: `containers` and `export` only use
2. LOC and CMAF wire containers in moq-mux: `containers` and `export` only use
`Container::Legacy`; sweep container x frame size x frames.
4. [Buffered browser groups](/quest/m2/performance-survey/hang-buffered.md)
3. [Buffered browser groups](/quest/m2/performance-survey/hang-buffered.md)
owns per-frame scans and bulk skip work in the Hang consumer.
5. [Browser media copies](/quest/m2/performance-survey/browser-media-copies.md)
4. [Browser media copies](/quest/m2/performance-survey/browser-media-copies.md)
owns CMAF sample copies and LOC encode allocation. Generic `js/msf` and
`js/flate` benchmark coverage remains here.
6. moq-quic loss recovery and real congestion controllers: every bench pins
5. moq-quic loss recovery and real congestion controllers: every bench pins
`Unlimited`; sweep controller x flight x loss x streams.
7. [Announcement snapshots](/quest/m2/performance-survey/announced-snapshots.md)
6. [Announcement snapshots](/quest/m2/performance-survey/announced-snapshots.md)
owns HTTP snapshot/rendering costs across routes and pollers.
8. JWT verification is covered: `moq-auth`'s `verify` bench runs nightly in
7. JWT verification is covered: `moq-auth`'s `verify` bench runs nightly in
`rust-extra` (see [bench/README.md](/bench/README.md#auth-verification)).
Signature verification dominated every asymmetric algorithm; nothing
was changed. Track its `decide`, `set` and `sessions` series here.
9. MPEG-TS import with real repeated media (the CLI bench mostly skips null
8. MPEG-TS import with real repeated media (the CLI bench mostly skips null
padding), and MKV, FLV, H.265, AV1 importers.
10. JS watch audio ring buffer and publish `Fanout` (lower impact). Include
capture-to-encoder staging: `audio/framer.ts` copies planes before
`audio/encoder.ts` joins them. AudioData already uses a transfer list;
do not count that transfer as another mandatory copy. Sweep publishers
x renditions, channels and frame duration in a browser.
9. JS watch audio ring buffer and publish `Fanout` (lower impact). Include
capture-to-encoder staging: `audio/framer.ts` copies planes before
`audio/encoder.ts` joins them. AudioData already uses a transfer list;
do not count that transfer as another mandatory copy. Sweep publishers
x renditions, channels and frame duration in a browser.

The [2026-10-22 source survey](/quest/m2/performance-survey/README.md) owns
the extracted items above and additional algorithmic hypotheses, with paired
benchmarks required before optimization. This audit still owns nightly
regression attribution and the remaining coverage. Its fragmented-MKV child
specializes item 9's MKV work.
specializes item 8's MKV work.

Single-axis fan-out benches to widen: `session_delivery_paced` (viewers only),
`track_fanout_*` (subscribers only), `memory` (lite-06 only), and
Expand Down
1 change: 0 additions & 1 deletion quest/m2/performance-survey/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ No duplicate quest or workflow edit belongs here.
- [Buffered browser groups](/quest/m2/performance-survey/hang-buffered.md) - per-frame scans and bulk skip work
- [Idle browser stats](/quest/m2/performance-survey/browser-idle-stats.md) - local transport polling without active publishing demand
- [UDP socket queues](/quest/m2/performance-survey/socket-queues.md) - drop attribution and queue-size tradeoffs across workers and load
- [Session datagrams](/quest/m2/performance-survey/datagram-delivery.md) - complete per-object delivery across publishers and viewers
- [Announcement snapshots](/quest/m2/performance-survey/announced-snapshots.md) - HTTP polling cost versus result size and unrelated routes
- [Selective session operations](/quest/m2/performance-survey/session-selection.md) - exact-ID lookups and registry lock hold time
- [Browser media copies](/quest/m2/performance-survey/browser-media-copies.md) - CMAF sample and LOC framing copies versus retention
Expand Down
32 changes: 0 additions & 32 deletions quest/m2/performance-survey/datagram-delivery.md

This file was deleted.

1 change: 1 addition & 0 deletions rs/moq-net/benches/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ criterion_group!(
benches,
session::session::<Model>,
session::group_cost::<Model>,
session::datagram::<Model>,
session::fetch_frames::<Model>,
session::fetch_range::<Model>,
session::range_updates::<Model>,
Expand Down
Loading
Loading