Skip to content

fix(runtime): write the velo response mux batch once every slot has a record - #5

Draft
ryanolson wants to merge 1 commit into
base/1434-666bc9d7d1from
velo-response-on-complete
Draft

ryanolson wants to merge 1 commit into
base/1434-666bc9d7d1from
velo-response-on-complete

Conversation

@ryanolson

@ryanolson ryanolson commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Draft.

With DYN_RESPONSE_PLANE=velo, the response mux holds each batch for its 2 ms window. A stream alone on its lane waits out the whole window for each record, so each request's first token arrives about 3.1 ms later than on the tcp plane.

This sets AutoFlush::on_complete with the 2 ms window. Completion flush can still wait: a batch flushes once every live slot on the lane has data, subject to the lane's spacing from the last data write. Two schedules show the boundary:

  • One stream: the prologue at 0 ms starts the lane's spacing. A first token staged at 0.75 ms misses that batch and is due at 2 ms.
  • Two streams: A's first record at 0 ms and B's at 0.25 ms can go together at 0.25 ms. If only A stages another record at 0.75 ms, that incomplete batch is due at 2.75 ms, against 2 ms for the original combined batch.

Both schedules passed the pinned Velo 0.22.1 gate. The measured first-token case is the lone stream, and its trip falls from 3,209 to 79 µs.

Measured on one GB300 node (dynamo frontend, 4 mocker workers, aiperf, ISL 1024 / OSL 256, median of 2-3 runs):

before after tcp plane
TTFT p50, speedup 1, c=8 45.5 ms 42.4 ms 42.4 ms
TTFT p50, speedup 10, c=64 / c=256 6.54 / 7.79 ms 5.81 / 6.35 ms 5.15 / 5.54 ms
TTFT p99, speedup 10, c=256 58.4 ms 40.4 ms 57.7 ms
Worker CPU per token, speedup 1, c=8 112.7 µs 94.4 µs 58.7 µs
Frontend CPU per token, speedup 10, c=64 / c=256 27.54 / 26.49 µs 28.6 / 29.0 µs 47.5 / 45.7 µs

The p99 and frontend rows are the medians of the two speedup-10 runs in the window (w_E). The old text rounded the p99 to 58 / 40 / 58; the raw medians are 58.4 / 40.4 / 57.7. The frontend baseline medians are 27.54 and 26.49 µs/token, not 27.7 and 26.7. TTFT p50 at speedup 1 is the median of three runs (w_C).

Rejected: DYN_VELO_RESPONSE_BATCH_MS=0 also removes the wait, but at speedup 10, c=64 frontend CPU per token rises from 27.5 to 54.2 µs, because the frontend receives 9.1 times more batches. At c=256 the multiplier is 12 times, and frontend CPU is 43.2 µs against 45.7 for tcp.

The packing table answers what the rejected alternative raised: completion flush keeps most of the packing.

Concurrency Data records per batch, before -> completion / zero window Frontend CPU µs/token, before -> completion / zero window / TCP
64 14.1 -> 12.5 / 1.55 27.5 -> 28.6 / 54.2 / 47.5
256 31.8 -> 26.8 / 2.64 26.5 -> 29.0 / 43.2 / 45.7

Completion raised received batches per token by 13% at c=64 and 18% at c=256, not by 9x or 12x.

Test: cargo test -p dynamo-runtime --lib -- pipeline::network::velo_response::tests::response_batch_policy fails without the change and passes with it. A T3 review (gpt-6.2-sol high) reproduced that: reverting only on_complete failed the default row, and forcing batch_ms = 0 failed too. cargo test -p dynamo-runtime --lib 931 passed, 2 ignored; clippy -D warnings and fmt clean for the root workspace.

State: rebased onto upstream main at 666bc9d7d1, which already carries velo 0.22.1. Head is f69e935c10. The only conflict was the test literal: main spells out on_complete: false, at_bytes: None; the resolution keeps at_bytes: None and takes on_complete from each row. The review's two schedules and the packing table are above.

Base is base/1434-666bc9d7d1, current upstream main, not fork main (pinned at 7c195fd1a7 for the gdl/port follow-along PR #3). The velo 0.22.1 bump is already upstream in ai-dynamo#17885; the stack's first PR is kept only for the record.

T3 review verdict: code passes. The reviewer reproduced the upstream test conflict and confirmed the test fails when on_complete is reverted or when batch_ms = 0 is forced.

@ryanolson
ryanolson had a problem deploying to external_collaborator November 22, 2026 05:52 — with GitHub Actions Failure
@github-actions github-actions Bot added the fix label Nov 22, 2026
… record

With the 2 ms window and no early write, a stream alone on its lane
waits out the whole window for each record, so every request's first
token arrived about 3.1 ms later than on the tcp plane. AutoFlush's
on_complete flushes once every live slot on the lane has data, subject
to the lane's spacing from the last data write, and keeps the window
for lanes that carry several streams.

Signed-off-by: Ryan Olson <[email protected]>
@ryanolson
ryanolson force-pushed the velo-response-on-complete branch from ba9b6cb to f69e935 Compare November 22, 2026 06:07
@ryanolson
ryanolson had a problem deploying to external_collaborator November 22, 2026 06:07 — with GitHub Actions Failure
@ryanolson
ryanolson changed the base branch from velo-0.22.1 to base/1434-666bc9d7d1 November 22, 2026 06:07

This branch had an error being deployed

1 failed deployment
external_collaborator — f69e935c Deployed Nov 22, 2026 by ryanolson via ok-to-test #31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant