Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions js/net/bench/subscribe-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ try {
const origin = new OriginProducer();
const broadcastRoute = origin.route(Path.from("bench"));
const broadcast = broadcastRoute.broadcast;
const track = broadcast.createTrack("video", { timescale: Timescale.MILLI });
const track = broadcast.createTrack("video", { timescale: Timescale.MILLI, maxAge: null });
for (let sequence = 0n; sequence < BigInt(groups); sequence++) {
const group = track.createGroup(sequence);
group.writeFrame(textFrame("frame"));
Expand Down Expand Up @@ -64,15 +64,16 @@ try {
server,
);
try {
// Lite-07 keeps the Subscribe Stream open past SUBSCRIBE_FINISH, so stop once every
// group is accounted for rather than waiting for its end.
let dropped = 0;
for (;;) {
while (dropped < groups) {
const response = await decodeSubscribeResponseMaybe(
client.reader,
Version.DRAFT_07,
);
if (!response) break;
if ("drop" in response)
dropped += Number(response.drop.end - response.drop.start + 1n);
if ("drop" in response) dropped += Number(response.drop.end - response.drop.start);
}
if (dropped !== groups) throw new Error(`dropped ${dropped}, expected ${groups}`);
client.writer.close();
Expand Down
25 changes: 0 additions & 25 deletions quest/m0/js-subscribe-drop-hang.md

This file was deleted.

4 changes: 0 additions & 4 deletions quest/m0/lite07-compression-bench-hang.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@ printed `Benchmarking` and nothing for the job's last 34 minutes, so the hang
starts with the first lite-07 cell, and every later bench in the job goes
unmeasured. Reproduce it locally, bisect against the lite-07 changes
if it is a regression, and fix it at the root.

## Related

- [JS subscribe-drop finishes](/quest/m0/js-subscribe-drop-hang.md) - another Nightly benchmark that hangs
18 changes: 18 additions & 0 deletions quest/m4/perf/js-subscribe-drop-single.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# [S] A lone JS subscriber's drops cost no more than shared ones

## Goal

In `just js bench subscribe-drop`, a drop costs no more for 1 publisher and
1 subscriber than for 16 x 16, or the PR that settles this explains why it
must.

## Plan

[moq-dev/moq#8520](https://github.com/moq-dev/moq/pull/8520) measured
1190 us per drop at 1 x 1, against 570 us at 16 x 16 and 160-220 us for the
fastest rows. No earlier run gives a baseline. Profile the 1 x 1 row
(`js/net/bench/subscribe-drop.ts`) to see whether the time goes to the drop
path in `js/net/src/lite/publisher.ts`, or to session setup and warmup that
the per-drop division only spreads over fewer drops. Fix a waste the
profile shows; if it is only warmup, make the benchmark warm up before
timing.