Skip to content

[Core] Cheapen the spin while waiting for model output - #65773

Merged
WoosukKwon merged 1 commit into
vllm-project:mainfrom
njhill:inputs-during-step-fast-spin
Nov 5, 2026
Merged

WoosukKwon merged 1 commit into
vllm-project:mainfrom
njhill:inputs-during-step-fast-spin

Conversation

@njhill

@njhill njhill commented Nov 5, 2026

Copy link
Copy Markdown
Member

#65466 waits for a step's output by looping on future.poll(), which runs several Python calls with the GIL held before each sched_yield(). This delays the engine's input and output threads, and costs some throughput and tail latency, even when no inputs are handled during the wait.

Between polls, spin directly on the response queue's flags and the input queue instead, so that an iteration costs about 1us rather than 4us. Inputs are still handled as they arrive, so requests still reach the scheduler about as early as with #65466 (median queue wait about 25us, compared with 5-7ms before it).

For a remote reader, move the sleep on its socket into this new wait, so that readable() is non-blocking again and a loop iteration sleeps only once.

Qwen3-0.6B on GB200, MP executor, Rust frontend. Medians, before #65466 -> #65466 -> this change:

TP=1, 8 repeats, arrivals (128/8 tokens, 256 concurrent):

  • 3,224 -> 3,133 -> 3,183 req/s; TTFT p99 58.8 -> 65.1 -> 59.7ms

TP=4, 3 repeats:

  • decode (32/512, 256 concurrent): 81,670 -> 74,830 -> 81,500 tok/s
  • single request (32/256): 685 -> 590 -> 700 tok/s

TP=4, 6 repeats, before #65466 -> this change:

  • arrivals: 2,839 -> 2,869 req/s
  • Poisson at 2,014 req/s: TTFT p99 47.0 -> 43.1ms; ITL p99 10.7 -> 10.3ms

vllm-project#65466 waits for a step's output by looping on future.poll(), which runs
several Python calls with the GIL held before each sched_yield(). This delays
the engine's input and output threads, and costs some throughput and tail
latency, even when no inputs are handled during the wait.

Between polls, spin directly on the response queue's flags and the input
queue instead, so that an iteration costs about 1us rather than 4us. Inputs
are still handled as they arrive, so requests still reach the scheduler about
as early as with vllm-project#65466 (median queue wait about 25us, compared with 5-7ms
before it).

For a remote reader, move the sleep on its socket into this new wait, so that
readable() is non-blocking again and a loop iteration sleeps only once.

Qwen3-0.6B on GB200, MP executor, Rust frontend. Medians, before vllm-project#65466 ->
vllm-project#65466 -> this change:

TP=1, 8 repeats, arrivals (128/8 tokens, 256 concurrent):
- 3,224 -> 3,133 -> 3,183 req/s; TTFT p99 58.8 -> 65.1 -> 59.7ms

TP=4, 3 repeats:
- decode (32/512, 256 concurrent): 81,670 -> 74,830 -> 81,500 tok/s
- single request (32/256): 685 -> 590 -> 700 tok/s

TP=4, 6 repeats, before vllm-project#65466 -> this change:
- arrivals: 2,839 -> 2,869 req/s
- Poisson at 2,014 req/s: TTFT p99 47.0 -> 43.1ms; ITL p99 10.7 -> 10.3ms

These were measured before moving the remote reader's sleep, which doesn't
affect them: they used only local readers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xgy3B6JERztsVgxhdteg6e
Signed-off-by: Nick Hill <nickhill123@gmail.com>

@claude claude 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@njhill njhill added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 5, 2026
@njhill

njhill commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #100075 for commit 798d3ae806bd.

@WoosukKwon
WoosukKwon merged commit ebac032 into vllm-project:main Nov 5, 2026
253 checks passed
@njhill
njhill deleted the inputs-during-step-fast-spin branch November 5, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants