One long prompt froze my streamed answers for a second: vLLM chunked prefill, measured
Two readers of my last post raised the same question: what happens on vLLM when long prompts arrive while other answers are already streaming? I rented an RTX 5090 and measured it.
Short version: with vLLM's default settings, one 12,000-token prompt barely touched the answers already streaming. With one flag changed, the short answers streaming at that moment froze for about a second each time a long prompt came in. The cost per token was the same both ways.
The setup
- RTX 5090 32 GB on vast.ai, $0.522/hour (South Korea, Ryzen 7 7800X3D host)
- vLLM 0.27.1, default flags, model Qwen2.5-7B-Instruct
- 16 short requests at once (prompts of about 512 tokens), every answer 256 tokens and streamed
- "Mixed" phase: the same 16, plus one request with a 12,000-token prompt every 10 seconds
- Two server settings:
- default (chunked prefill on)
-
--max-num-batched-tokens 16384: still chunked prefill, but the budget is big enough to read the whole 12,000-token prompt in one step
For every answer I recorded the whole answer time, the first token, and the biggest pause between two streamed tokens. That pause is what a user sees as the answer "freezing".
What happened to the short answers
With long prompts mixed in:
- Default: the biggest pause inside an answer was 0.18 s at p95. 0 of 240 answers paused for more than 0.3 s.
- 16,384 budget: the biggest pause was 0.97 s at p95. 105 of 240 answers paused for more than 0.3 s.
So with the big budget, the short answers running when a long prompt arrived stopped for about a second while it was read. With the default, vLLM split the long prompt into pieces and slipped them between the short answers' tokens.
Did the long request pay for that?
One reader expected it would, because splitting a prompt into pieces should delay its first token. It didn't here:
- Long prompt, first token: 0.99 to 1.00 s with the default, 1.00 to 1.01 s with the big budget
- Cost per 1M output tokens: $0.141 vs $0.142
Smoother streams for everyone else, and nothing lost that I could measure.
vLLM didn't log its batch budget for the default config. In the 0.27.1 source, the default for the API server on a GPU under 70 GB is 2,048 tokens. The numbers fit that (the longest pause, 0.18 s, is about one sixth of the long prompt's 1 s read time), but I'm stating it from the source, not from a log.
Long prompts cost more than they look
A second run on the same card, with every prompt about 2,000 tokens instead of 512:
- 1 request at once: +5% cost per output token
- 16 at once: +52%
- 64 at once: 2.4x
At high load the card spends much of its time reading prompts, and reading prompts produces no output tokens. So an average prompt length can hide a 2.4x cost difference.
Limits
- One run per phase, one card, one model, synthetic prompts.
- Six long prompts per mixed phase, at a fixed 10-second interval. Real traffic arrives in bursts.
- I didn't turn chunked prefill fully off. In vLLM 0.27.1 that logs a warning that it "may cause the engine to crash" for this model, so the 16,384 budget stands in for it at this prompt length.
- Costs assume the GPU is busy the whole time.
The data and the script
Every server log, the /metrics snapshots, and the timing of each request are here:
https://github.com/qaisermehdi3-coder/qvunex/tree/main/benchmarks/data/mixed-5090-2026-11-09
If you have a GPU, one command runs the same test (about 12 minutes, synthetic prompts, nothing leaves your machine). Put your price per hour after the --:
curl -sL https://raw.githubusercontent.com/qaisermehdi3-coder/qvunex/main/mixed.sh | bash -s -- YOUR_PRICE_PER_HOUR Which GPU is cheapest at your answer time, from all my runs so far: https://qaisermehdi3-coder.github.io/qvunex/