Scenario
The radix cache turned off for predictability
RolesInference EngineeringLLM Product Engineering
- Engine
- SGLang 0.5.22, with vLLM 0.31.0 as the second engine
- Model
- Qwen/Qwen3-30B-A3B-Instruct-2507 on the GB10, and Qwen/Qwen3-8B on the L4
- Hardware
- one GB10 with 128 GB of unified memory, and one L4 with 24 GB of memory
Situation
After a benchmark incident in which a warm prefix cache made a loaded server look faster, a platform team writes a new policy: production and benchmarks must agree, so every SGLang server starts with --disable-radix-cache, and the vLLM replicas start with --no-enable-prefix-caching. The rollout goes out on a Friday.
On Monday a customer whose assistant sends a system prompt of about two thousand tokens with every question reports that the first token now takes several seconds instead of under one, and that the service answers fewer questions per minute at the same user count. The platform team replies that nothing changed in the model or the hardware, and that the new numbers are the "true" ones. You are asked to settle it.
Questions
- What does a prefix cache change about the work a server does, and what does it leave the same?
- From the two GB10 runs, how much did the first token and the throughput move, and which line proves that the same work was requested?
- Read the four L4 prefill lines. What do
#new-token,#cached-tokenand#pending-tokensay about each configuration? - Both engines were measured. Does the effect belong to one engine, and how does its size depend on the shared length?
- The policy wanted predictable numbers. Which fix gives that without the cost?
Commit to a cause after each listing. Write it down before you read the next one.
Evidence
the shared-prefix benchmark: four groups of 16 prompts with one system prompt each
Read the second paragraph.
## The same workload with and without the tree
The capture kit runs SGLang's own shared-prefix benchmark twice. Four groups of 16 prompts share a 2,048-token system prompt per group, and each prompt adds a 128-token question. The second server starts with `--disable-radix-cache`.Source: manuals/sglang-101/sections/3-3-radixcache.md, lines 9-11
the shared-prefix run on the GB10 with the radix cache on
Read the duration, the input token count, the output throughput and the median TTFT.
============ Serving Benchmark Result ============
Backend: sglang
Traffic request rate: inf
Max request concurrency: 8
Successful requests: 64
Benchmark duration (s): 28.97
Total input tokens: 146646
Total input text tokens: 146646
Total generated tokens: 4096
Total generated tokens (retokenized): 3913
Request throughput (req/s): 2.21
Input token throughput (tok/s): 5061.63
Output token throughput (tok/s): 141.38
Peak output token throughput (tok/s): 216.00
Peak concurrent requests: 16
Total token throughput (tok/s): 5203.01
Concurrency: 8.00
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 3619.45
Median E2E Latency (ms): 3592.55
P90 E2E Latency (ms): 4616.12
P95 E2E Latency (ms): 4616.30
P99 E2E Latency (ms): 4616.49
---------------Time to First Token----------------
Mean TTFT (ms): 712.02
Median TTFT (ms): 690.96
P90 TTFT (ms): 1146.81
P95 TTFT (ms): 1944.53
P99 TTFT (ms): 2051.54 Source: manuals/sglang-101/capture/gpu/out-gb10/bench-shared-prefix.txt, lines 11-39
the same run on the GB10 with --disable-radix-cache
The input token count is the same as before; compare the duration, the output and the TTFT block.
============ Serving Benchmark Result ============
Backend: sglang
Traffic request rate: inf
Max request concurrency: 8
Successful requests: 64
Benchmark duration (s): 50.26
Total input tokens: 146646
Total input text tokens: 146646
Total generated tokens: 4096
Total generated tokens (retokenized): 3916
Request throughput (req/s): 1.27
Input token throughput (tok/s): 2917.46
Output token throughput (tok/s): 81.49
Peak output token throughput (tok/s): 200.00
Peak concurrent requests: 16
Total token throughput (tok/s): 2998.95
Concurrency: 7.99
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 6278.45
Median E2E Latency (ms): 6122.43
P90 E2E Latency (ms): 6648.68
P95 E2E Latency (ms): 6652.19
P99 E2E Latency (ms): 6653.05
---------------Time to First Token----------------
Mean TTFT (ms): 2391.67
Median TTFT (ms): 2542.06
P90 TTFT (ms): 3272.33
P95 TTFT (ms): 3299.83
P99 TTFT (ms): 3304.86 Source: manuals/sglang-101/capture/gpu/out-gb10/no-radix-cache-bench-shared-prefix.txt, lines 11-39
two prefill lines on the L4 with the cache, 2,048 shared tokens
Read #new-token against #cached-token.
[2026-10-17 13:21:05] Prefill batch, #new-seq: 3, #new-token: 405, #cached-token: 12952, token usage: 0.58, #running-req: 1, #queue-req: 0, #pending-token: 0, cuda graph: True, input throughput (token/s): 1452.28
[2026-10-17 13:21:06] Prefill batch, #new-seq: 4, #new-token: 546, #cached-token: 17269, token usage: 0.58, #running-req: 4, #queue-req: 0, #pending-token: 0, cuda graph: True, input throughput (token/s): 2532.09Source: manuals/sglang-101/capture/gpu/out-l4/server-prefix-default.log
two prefill lines on the L4 without the cache, 4,096 shared tokens
Every token is new, and the pending tokens wait for the next chunk.
[2026-10-17 14:35:48] Prefill batch, #new-seq: 2, #new-token: 4096, #cached-token: 0, token usage: 0.68, #running-req: 1, #queue-req: 0, #pending-token: 5527, cuda graph: True, input throughput (token/s): 1632.42
[2026-10-17 14:35:50] Prefill batch, #new-seq: 2, #new-token: 4096, #cached-token: 0, token usage: 0.74, #running-req: 2, #queue-req: 0, #pending-token: 1431, cuda graph: True, input throughput (token/s): 1634.70Source: manuals/sglang-101/capture/gpu/out-l4/server-prefix-no-radix-cache.log
the same test on the other engine, cache on and off by shared length
Read the 1,024-token row first; the text under the table says why the last two rows need care.
| Shared prompt tokens, L4 full-clock session | Median TTFT, cache on | Median TTFT, cache off | Output tok/s, on / off |
|---|---|---|---|
| none | 408 ms | 392 ms | 113.8 / 113.6 |
| 256 | 488 ms | 753 ms | 111.5 / 99.1 |
| 1,024 | 396 ms | 1,213 ms | 106.0 / 70.9 |
| 2,048 | 410 ms | 2,550 ms | 100.2 / 46.6 |
| 4,096 | 375 ms | 13,353 ms | 86.8 / 19.6 |
With the cache on, the first token took about 400 ms at every prefix length. With the cache off, the first token grew with the shared part, because every request computed the whole prompt again.
Read the last two rows with care. Without the cache, the GPU throttled. The median clock fell to 1,035 MHz at 2,048 tokens and to 675 MHz at 4,096 tokens. The cleanest comparison is the 1,024-token row, where both runs held 1,410 MHz or more. There the cache cut the first token about 3 times and gave 50 percent more output. The runs with the cache on were on 2026-10-17 and 2026-10-18, and the runs with it off on 2026-10-21.Source: manuals/vllm-101/sections/3-2-make-repeated-prompts-hit-the-prefix-cache.md, lines 13-23
the SGLang table on the L4 by shared length, with the clock caveat
The two paragraphs under the table bound the factor.
| Shared prompt | Median TTFT, cache on | Median TTFT, cache off | Output tok/s, cache on | Output tok/s, cache off |
|---|---|---|---|---|
| 0 | 349 ms | 379 ms | 113.56 | 113.33 |
| 1,024 | 462 ms | 2,202 ms | 105.76 | 70.15 |
| 4,096 | 479 ms | 14,706 ms | 88.87 | 20.80 |
The median SM clock was 1,440 MHz with the cache and 930 MHz without it at 4,096 shared tokens. Every seed of the run without the cache stayed under our floor of 1,000 MHz.
**We measured** a 30.7 times shorter median wait and 4.3 times the throughput at 4,096 shared tokens. Treat both factors as upper bounds. The run without the cache had a thermal throttle flag in 62 percent of its samples and a 35 percent lower clock. A cool card would shrink the factor, but a 35 percent clock gap cannot explain a factor of 30. With no shared prompt, the median TTFT differed by 8 percent, inside the seed spread, and the throughput was the same.Source: manuals/sglang-101/sections/3-3-radixcache.md, lines 86-94
The answer
Show the walkthrough
- Know what the cache saves. The tree indexes the KV entries of every prompt the server has seen. A new request reuses the longest matching prefix and prefills only the tokens after it. The decode work stays the same, so a cache hit removes prefill time and nothing else. A system prompt that every request repeats is the best case: the whole shared part comes from the tree.
- Read the workload. The kit runs the engine's own shared-prefix benchmark: four groups of 16 prompts, one system prompt of 2,048 tokens per group, a 128-token question on each prompt, and a cap of eight requests at once. The second server starts with the cache disabled.
- Compare the two GB10 runs. Both report 146646 input tokens over 64 requests, so the client asked for the same work. With the cache the run took 28.97 s and gave 141.38 output tokens per second with a median TTFT of 690.96 ms. Without it the run took 50.26 s, the output fell to 81.49, and the median TTFT rose to 2542.06 ms, with a P99 of 3304.86 ms against 2051.54. The input tokens per second tell the same story: 5061.63 with the tree and 2917.46 without. The customer's two complaints, a slower first token and fewer answers per minute, are both in this pair.
- Read the L4 prefill lines. With the cache and a 2,048-token shared prompt, one batch prefilled 405 new tokens and took 12952 from the cache, and the next prefilled 546 new with 17269 cached. Without the cache and a 4,096-token shared prompt, each batch prefilled 4096 new tokens with 0 cached, and 5527 tokens were still pending for the next chunk. Every request paid for its whole prompt, in chunks of the prefill size, while the others waited.
- Check the other engine. On the L4 with vLLM, the cache kept the median first token near 400 ms at every shared length: 408, 488, 396, 410 and 375 ms. Without it the first token grew with the shared part: 392, 753, 1,213, 2,550 and 13,353 ms, and the output fell from 113.6 to 19.6 tokens per second. The manual asks to read the last two rows with care, because the GPU throttled there, and names the 1,024-token row as the clean comparison: about three times the first token and 50 percent more output with the cache. The effect is the same on both engines, and it grows with the shared length.
- Bound the factor. The SGLang table on the L4 reads 479 ms against 14,706 ms at 4,096 shared tokens, 30.7 times, and 4.3 times the throughput. The run without the cache ran at 930 MHz against 1,440 with it, with a thermal flag in 62 percent of its samples, so the manual treats both factors as upper bounds and notes that a 35 percent clock gap cannot explain a factor of 30. Read the GB10 pair, which had no such gap, for the size you can trust.
Show the resolution
The policy caused the incident. The cache was never what made the benchmark lie; the method was, because the kit reused one seed on one server and never flushed between runs. Removing the cache from production removed the work-saving that the customer's traffic depends on. On the GB10, the shared-prefix run saw its median TTFT go from 690.96 ms to 2542.06 ms, and its output went from 141.38 to 81.49 tokens per second, for the same 146646 input tokens.
The fix is to turn the cache back on, on both engines, and to make the benchmarks predictable by protocol: flush the cache before each run that you compare, use a new seed per run, and record the cached tokens next to the result. Prove the production fix with #cached-token in the prefill lines, which should carry most of each shared prompt, and with the median TTFT of the customer's traffic back near the cached level. Keep the manual's one exception: turn the cache off only to test whether a wrong answer comes from reused KV, and try --kv-canary log first.
Show the wrong turns
“The cache made the benchmark lie, so it has no place in production.”
The benchmark lied because it reused its prompts without a flush. The cache in production serves prompts that really repeat, and the customer's system prompt is exactly that.
“Only the first token is affected, throughput is unchanged.”
On the GB10 the output fell from 141.38 to 81.49 tokens per second and the run took 50.26 s instead of 28.97. Prefill that is computed again occupies steps that decode would have used.
“The effect is an SGLang detail.”
The other engine moved from 396 to 1,213 ms at 1,024 shared tokens and from 375 to 13,353 ms at 4,096, on the same card.
“Shorten the customer's system prompt instead.”
The prompt is the customer's product. A server feature that removes the repeated work is the cheaper fix, and the manual measured no cost from the cache when nothing is shared.
“Keep it off, because a wrong answer might come from reused KV.”
That is the one reason the manual accepts, and even then it asks you to try
--kv-canary logfirst and to turn the cache off only for the test.
Show the general rule
A measurement artifact is fixed in the measurement, not in the system. When a cache or any other state carries over between benchmark runs, reset the state between runs and record it; do not remove the mechanism from production, where the same state is the point. Before you change a default that saves work, measure the traffic that repeats and count what the default saves there.
Taught in
The SGLang manual measures the pair in the RadixCache page, the vLLM manual measures the other engine in the prefix cache page with the full table in the lab notes, and the RadixAttention lesson teaches the tree and where it wins and loses.