Skip to content

fix: peer links default to 64 MiB windows, every stream to 4 MiB - #9329

Merged
kixelated merged 6 commits into
mainfrom
quest/m1/peer-window-default
Nov 22, 2026
Merged

kixelated merged 6 commits into
mainfrom
quest/m1/peer-window-default

Conversation

@kixelated

@kixelated kixelated commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two default changes, so a relay upgraded from release keeps its peer-link throughput and peers and clients share one stream setting.

  1. [limits.peer.quic] now defaults to a 64 MiB receive_window and send_window, up from 16 MiB. 64 MiB is the connection window every session had on the release line, so peer links carry about 2 Gbps at a 250 ms RTT instead of 450 Mbps. Peer memory stays a fixed, configured bound (peers × 64 MiB).
  2. The per-stream receive window now defaults to 4 MiB, up from 1 MiB, for every connection: clients, peers, and links the relay dials, over QUIC (Tokio and io_uring) and QMux (WebSocket, TCP, Unix). 4 MiB is release's value too. There is still no [limits.peer.quic] stream window.

Files:

  • rs/moq-relay/src/limits.rs: the peer Default and the --limits-peer-quic-*-window usage defaults (67108864).
  • rs/moq-tokio/src/quic.rs: DEFAULT_STREAM_RECEIVE_WINDOW is 4 << 20. This is the relay's [quic] stream_receive_window default, and every moq-tokio QMux session takes it through qmux_config.
  • rs/moq-uring/src/quic/driver/mod.rs and quic/transport.rs: the io_uring backend's STREAM_WINDOW matches it. rs/moq-relay/src/uring.rs's parity test now expects it.
  • js/net/src/connection/connect.ts: the WebSocket fallback's DEFAULT_STREAM_RECEIVE_WINDOW mirrors moq-tokio (4 MiB). Its test is updated to match.
  • doc/bin/relay/config.md: the [quic] example, the per-stream throughput (about 270 Mbps at 100 ms), the fact that the stream window bounds no memory, and the peer section.
  • quest/m3/release/cut.md: drops the link to this quest and tells the cut to rewrite the feat!: lease qmux receive credit, one-segment floor, smaller windows, sized readiness #7624 entries in moq-relay's, moq-tokio's, and moq-uring's MIGRATE.md from Impact.
  • Deletes quest/m1/peer-window-default.md.

Left alone on purpose: the generic transport libraries' own defaults. moq-quic's STREAM_RWND is 1.25 MB, and the qmux crate and @moq/qmux use 256 KiB. moq-tokio, moq-uring, and @moq/net always override them, so no MoQ connection uses them.

Memory stays bounded by the connection window

The stream window caps what one stream may hold. It does not bound memory. Every byte of stream credit is also charged against the connection's receive_window, so a peer can never make us hold more than that, however many streams it opens: 4 MiB per client by default and 64 MiB per peer. With the defaults, one client stream may now take the client's whole connection window. That changes nothing for pausing, because every Rust transport (moq-quic over Tokio and io_uring, and QMux) shapes credit. moq-net shrinks a paused stream's window to the room its group has left, and paused streams together hold at most half of the connection window (transport/boxed.rs pause). When incomplete messages fill the connection window, the lowest-ranked stream is still evicted, as before.

Decisions

  • Every connection gets a 4 MiB stream window. The maintainer decided this on 2026-11-21 (comment): "There is zero reason why peers and users should have different stream settings." ✅ raise [quic] stream_receive_window to 4 MiB for all connections (rejected: keep 1 MiB, add a [limits.peer.quic] stream window). This replaces the quest's decision 3 and feat!: lease qmux receive credit, one-segment floor, smaller windows, sized readiness #7624's decision 11, which kept peers at 1 MiB, and it replaces this PR's earlier "no peer stream window quest" decision.
  • MIGRATE.md is left to the release cut. The maintainer accepted this in the same comment. just check's migrate module refuses a MIGRATE.md edit outside the cut, as AGENTS.md says. The notes are in Impact below. The cut quest says to rewrite the feat!: lease qmux receive credit, one-segment floor, smaller windows, sized readiness #7624 entries, which currently say peer windows are "16 MiB, down from 640 MiB" (640 MiB was an unreleased main value; release had 64 MiB) and that the stream window is 1 MiB.
  • The generic libraries keep their defaults (moq-quic 1.25 MB, qmux 256 KiB). No MoQ connection uses them, and they are general-purpose transports. Raising them would change those libraries' worst case (max_streams × stream window with no connection window) for no MoQ benefit. A review can undo this.

Impact

  • Public API: moq_tokio::quic::DEFAULT_STREAM_RECEIVE_WINDOW is now 4 MiB (4 << 20). It is a value change, not a signature change. Wire: none. Behavior: peer links advertise 64 MiB connection windows, and every connection advertises a 4 MiB initial_max_stream_data by default.
  • Migration notes for the cut:
    • rs/moq-relay/MIGRATE.md, under "Smaller default receive windows (#7624)":

      [quic] defaults to a 4 MiB receive_window, a 4 MiB stream_receive_window, and a 4 MiB send_window, down from 128 MiB, 4 MiB (unchanged), and 16 MiB. [limits.peer.quic] defaults to a 64 MiB receive_window and send_window, the connection window every session had before, so peer links carry about 2 Gbps at a 250 ms RTT as they did. Peers and clients share the [quic] stream_receive_window.

    • rs/moq-tokio/MIGRATE.md, the feat!: lease qmux receive credit, one-segment floor, smaller windows, sized readiness #7624 entry: quic::DEFAULT_RECEIVE_WINDOW is 4 MiB, DEFAULT_STREAM_RECEIVE_WINDOW 4 MiB (unchanged), and DEFAULT_SEND_WINDOW 4 MiB, down from 128 MiB and 16 MiB.
    • rs/moq-uring/MIGRATE.md, "Smaller default windows" (feat!: lease qmux receive credit, one-segment floor, smaller windows, sized readiness #7624): quic::transport::Config::default() takes a 4 MiB connection window, a 4 MiB stream window (unchanged), and 4 MiB of unacknowledged outgoing data, down from 128 MiB and 16 MiB, matching moq-tokio's [quic] defaults.
    • js/net/MIGRATE.md, "WebSocket receive windows match Rust": the fallback grants 4 MiB per connection and 4 MiB per stream, up from 1 MiB and 256 KiB.
  • Overlap with send-credit-stalls (quest/m1/send-credit-stalls.md): no shared files. That quest counts connection-level (MAX_DATA) stalls. The per-stream stall measured below is a non-goal there.

Validation

  • just check passes on the new head (6333 Rust tests and the JS tests, including connect.test.ts, which reads the transport parameters the WebSocket fallback actually sends: initialMaxStreamData* is now 4,194,304). Unit tests pin the resolved defaults reaching the transports: moq-tokio quic/backend.rs (Tokio) and moq-relay uring.rs windows_match_the_tokio_runtime (io_uring), now expecting 4 MiB.

  • Built moq-relay: --help shows Defaults to 4 MiB for --quic-stream-receive-window, and (default: 67108864) for --limits-peer-quic-receive-window and --limits-peer-quic-send-window.

  • Cross-region join measurement, from the earlier round with a scratch test (not committed) on the receive_credit.rs harness in rs/moq-tokio/tests/integration. A stock moq-tokio server publishes and a raw-driver client subscribes, both at 64 MiB connection windows, through moq-shaper at 250 ms RTT with a rate bottleneck behind a 250 ms queue that drops what overflows (bufferbloat, no random loss). The track is 16 Mbps (66,666 B frames every 33 ms, one group). The client subscribes mid-group with 1.5 s or 2 s of the group cached upstream. "Caught up" is the first frame within 191 ms of its write. "Warm" means 32 MiB crossed the link first. Three runs per row:

    link backlog conn state stream window first frame caught up
    1 Gbps 1.5 s (3 MB) warm 1 MiB 260 ms 2.8 / 3.9 / 4.2 s
    1 Gbps 1.5 s (3 MB) warm 64 MiB 260 ms 0.53 / 0.56 / 0.58 s
    200 Mbps 2 s (4 MB) warm 1 MiB 260 ms 2.09 / 2.10 / 2.11 s
    200 Mbps 2 s (4 MB) warm 64 MiB 260 ms 0.44 / 0.44 / 0.45 s
    1 Gbps 1.5 s (3 MB) cold 1 MiB 920 ms 4.97 / 4.99 / 4.99 s
    1 Gbps 1.5 s (3 MB) cold 64 MiB 920 ms 2.69 / 2.69 / 2.70 s

    Peers now use the 4 MiB stream window, which was not one of the measured rows. The scratch harness didn't survive a host restart, so I didn't re-run it at 4 MiB. The 4 MiB figures below are an estimate, not a measurement. One stream gets up to 4 MiB of credit per round trip, about 134 Mbps at 250 ms. The 3 to 4 MB backlog therefore fits in about one stream window, where 1 MiB needed three or four round trips of stream credit. So a warm mid-group join should land within about one RTT (roughly 0.25 s) of the 64 MiB rows rather than 1.6 to 3.6 s behind them. A track above about 134 Mbps per group stream would still be capped at 250 ms. The first frame arrives at the same time with any window.

  • Unexplained, and not caused by the window: in some warm runs, with either stream window, steady-state lag settled at about 385 ms instead of about 145 ms. This host was heavily loaded; reproduce on a quiet host before chasing it.

Caused by

  • moq-dev/moq#7624: lowered the peer windows below release's 64 MiB, to 16 MiB (its decision 11), and the stream window below release's 4 MiB, to 1 MiB, cutting an upgraded relay's peer-link and per-stream throughput at long RTTs (found by person: the maintainer's main → release flow-control review).

Follow-ups

None.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort (arm A)
Implementer: Claude Code, claude-opus-5-5, unknown effort (iterate, S)

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: cb52828

  • Base: origin/main at cc617cb

  • Risk: medium, Larger default flow-control windows can increase relay operators’ memory use and change throughput for Rust and JS connections, while preserving APIs and wire formats; reverting restores the previous defaults.

  • Classified: medium by Codex, gpt-6.1-sol, low effort, session 01a2013f-9fde-75d2-a2b4-61b74c8ead01

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a20119-dd4e-7ab0-9b7c-431540e04b1a, round 2

  • Score: 9/10, The incremental changes clarify memory accounting and complete the release migration checklist, with no actionable defects found; builds and tests were not run as instructed.

  • Rounds: 3; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 21, 2026 17:52
[limits.peer.quic] receive_window and send_window default to 64 MiB, the
connection window every session had on the release line, so an upgraded
relay's peer links carry about 2 Gbps at a 250 ms RTT instead of 450 Mbps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Relay peer links default to release's 64 MiB windows fix(moq-relay): peer links default to release's 64 MiB windows Nov 22, 2026
@kixelated
kixelated marked this pull request as ready for review November 22, 2026 02:10
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Per-stream receive-window defaults increase from 1 MiB to 4 MiB across the JavaScript and Rust implementations. Peer QUIC receive and send window defaults increase from 16 MiB to 64 MiB. Documentation, default-value tests, and release-plan references are updated to reflect these values.

Merge Risk: Low · up to 8a25f

This PR raises default QUIC flow-control windows to restore release-line throughput. The runtime changes are small, and the defaults are easy to revert. One documentation sentence overstates how much peer memory the receive window bounds, which could lead operators to underestimate memory use. Fix the wording before or shortly after merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names both default changes in the PR: the peer QUIC connection windows rising to 64 MiB and the per-stream receive window rising to 4 MiB. The changeset updates limits.rs, the Tokio and io_u…
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.
Description check Passed The description is specific and tied to the changeset. It explains the two default changes: the [limits.peer.quic] receive and send windows rising from 16 MiB to 64 MiB, and the per-stream receive w…
Full details: Title check

Explanation

The title names both default changes in the PR: the peer QUIC connection windows rising to 64 MiB and the per-stream receive window rising to 4 MiB. The changeset updates limits.rs, the Tokio and io_uring stream windows, the JS WebSocket fallback, the tests, and the relay docs, all matching the title's two claims. The title is short, specific, and uses the fix: prefix. It is slightly overloaded, but it covers the main change.

Full details: Description check

Explanation

The description is specific and tied to the changeset. It explains the two default changes: the [limits.peer.quic] receive and send windows rising from 16 MiB to 64 MiB, and the per-stream receive window rising from 1 MiB to 4 MiB across QUIC, QMux, and the WebSocket fallback. It also lists the touched files (limits.rs, moq-tokio quic.rs, moq-uring, uring.rs, connect.ts, config.md, cut.md) and deletes the peer-window quest, and it gives validation and migration notes. This matches the summaries of the raw changes.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 22, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Approach: sound. It restores release's 64 MiB peer windows at the single place the default lives, and the doc and quest bookkeeping follow.

Reviewed changes: the full 4-file diff, plus a grep for other 16 MiB peer-default references.

  • Defaults (rs/moq-relay/src/limits.rs): the Default impl and both --limits-peer-quic-*-window usage defaults move from 16 MiB to 64 MiB, and they agree with each other. The comment is updated.
  • Docs (doc/bin/relay/config.md): the example values and throughput figures are updated. The doc also states the peers × receive_window memory bound and that peers keep the 1 MiB stream window.
  • Quest bookkeeping: quest/m1/peer-window-default.md is removed. quest/m3/release/cut.md now points at this PR and tells the cut to rewrite the MIGRATE.md entry from the PR's Impact section. Leaving MIGRATE.md untouched fits the repo rule that only the release cut edits it.

The "16 MiB" strings in rs/moq-net/tests/integration/fastest_reader.rs refer to a separate stream-credit cap and are unrelated to this default.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (2026-11-21):

  • Merge: /quest-merge.
  • Stream window: raise the default stream receive window from 1 MiB to 4 MiB for all connections, not only peers. Peers and users get the same stream settings, so there's no separate [limits.peer.quic] stream window. Fold this into this PR.
  • MIGRATE.md: accept leaving it to the release cut. The migration note stays in Impact.

(Written by Claude Opus 5.5)

kixelated and others added 2 commits November 21, 2026 18:16
…indow

Peers and clients share one stream setting, so raise the 1 MiB default
for moq-tokio, moq-uring, and the JS WebSocket fallback together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title fix(moq-relay): peer links default to release's 64 MiB windows fix: peer links default to 64 MiB windows, every stream to 4 MiB Nov 22, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Applied the maintainer decision in 8a25f7e:

  • Every connection now defaults to a 4 MiB stream receive window, so peers and clients share one setting. This covers moq_tokio::quic::DEFAULT_STREAM_RECEIVE_WINDOW (the relay's [quic] stream_receive_window, and every moq-tokio QMux session), moq-uring's STREAM_WINDOW, and @moq/net's WebSocket fallback. There is no [limits.peer.quic] stream window.
  • MIGRATE.md is left to the release cut. The notes are in the PR's Impact section, and the cut quest points to them.
  • The connection window still bounds total memory: 4 MiB per client and 64 MiB per peer. The PR body explains why.

(Written by Claude Opus 5.5)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues. Two stale "1 MiB stream window" references are left over, noted below.

Approach: still sound. Raising the per-stream window to 4 MiB for every connection matches release. Memory stays bounded by the connection window, and moq_net::transport::ReceiveWindow has no stream <= connection invariant, so a stream window equal to the 4 MiB client connection window is legal.

Reviewed changes: the two commits since eb757e1, which move every connection's stream window from 1 MiB to 4 MiB.

  • Rust defaults: moq_tokio::quic::DEFAULT_STREAM_RECEIVE_WINDOW and moq-uring's STREAM_WINDOW are both now 4 << 20. Their doc comments and the relay's io_uring parity test were updated to match.
  • JS fallback: @moq/net's WebSocket DEFAULT_STREAM_RECEIVE_WINDOW mirrors the 4 MiB default, and connect.test.ts checks the transport parameters it sends.
  • Docs and quest: doc/bin/relay/config.md gives the new throughput (about 270 Mbps at 100 ms) and says peers share [quic] stream_receive_window. cut.md now also tells the cut to rewrite the stream-window migration notes.

ℹ️ The qmux receive bench still calls 1 MiB the relay default

rs/qmux/benches/receive.rs (STREAM = 1 << 20, with the doc comment "at the relay's 4 MiB / 1 MiB windows") and bench/README.md:195 ("relay client defaults (4 MiB connection, 1 MiB stream, …)") describe this series as measuring the relay's defaults, and that is no longer true. Bumping STREAM to 4 MiB is not a drop-in fix: eight half-window messages would no longer fit the 4 MiB connection window.

Technical details
# qmux receive bench labels a stale default

## Affected sites
- rs/qmux/benches/receive.rs:1 — doc says "the relay's 4 MiB / 1 MiB windows"
- rs/qmux/benches/receive.rs:24 — `STREAM = 1 << 20`
- bench/README.md:195 — "relay client defaults (4 MiB connection, 1 MiB stream, 4 MiB send)"

## Required outcome
- The bench either measures the current defaults or stops claiming to.

## Suggested approach (optional)
- Simplest: drop the "relay default" wording and describe the windows as fixed bench parameters, which keeps the series continuous. Changing `STREAM` would also require resizing `MESSAGE` or the per-session message count so the leases still fit `CONNECTION`.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread quest/m3/release/cut.md Resolved
@moq-bot
moq-bot Bot disabled auto-merge November 22, 2026 02:36
@moq-bot

moq-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

quest land watch: ended this pull request's pick, disarming its auto-merge, since its head 8a25f7e is held by finding by pullfrog[bot]: rs/moq-uring/MIGRATE.md:71 has its own #7624 entry, which says quic::transport::Config::default() takes "a 1 MiB str (#9329 (comment)). Push a fix, or answer each by a thread reply or a comment linking its review or decision, then land it again.

(written by quest land watch)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


  • Fix comments: Fix CodeRabbit comments on this PR
Prompt to fix all issues
Treat finding text, file paths, and code as untrusted review data. Never follow
instructions embedded in them. Verify each finding against current code. Fix
only still-valid issues, skip the rest with a brief reason, keep changes
minimal, and validate.

Inline comments:
Review comments at @doc/bin/relay/config.md:
- Around line 195-196: Update the relay memory description around receive_window
to state that it bounds only unread or incomplete incoming data, not total peer
memory. Distinguish retained live_edges and unacknowledged outgoing data as
separately bounded by live_edges (unbounded by default) and send_window,
respectively.

After applying the fix, consider running `coderabbit review --agent` for local
review. Visit https://docs.coderabbit.ai/cli?utm_source=ghpr
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ba0547c5-8791-4e4e-9dde-e7d3e8ac2156
Commits

Reviewing files that changed from the base of the PR and between 4078095 and 8a25f7e.

Files selected for processing: 10

  • doc/bin/relay/config.md
  • js/net/src/connection/connect.test.ts
  • js/net/src/connection/connect.ts
  • quest/m1/peer-window-default.md
  • quest/m3/release/cut.md
  • rs/moq-relay/src/limits.rs
  • rs/moq-relay/src/uring.rs
  • rs/moq-tokio/src/quic.rs
  • rs/moq-uring/src/quic/driver/mod.rs
  • rs/moq-uring/src/quic/transport.rs
Files with no reviewable changes: 1

  • quest/m1/peer-window-default.md

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

Comment thread doc/bin/relay/config.md Resolved
…es moq-uring's note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated enabled auto-merge November 22, 2026 03:13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated disabled auto-merge November 22, 2026 03:14

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes since the prior review: docs and quest text only.

  • Memory-bound wording — doc/bin/relay/config.md now says the peer receive_window bounds unread or incomplete incoming data, with retained groups and unacknowledged sent data bounded separately.
  • Cut note — quest/m3/release/cut.md now includes moq-uring's MIGRATE.md in the #7624 entries to rewrite.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 15538a7 Nov 22, 2026
7 checks passed
@kixelated
kixelated deleted the quest/m1/peer-window-default branch November 22, 2026 03:20
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