On this page
The short answer
- predicted by a three-term sum
- 0.865 s
- measured, fastest configuration
- 0.87 s
Most of the gap was our own client settings: the SGLang adapter kept too few requests in flight. Raising them took the read from 1.56‑1.76 s to 1.04‑1.08 s on the profile machine, and that is now the default. The rest is how SGLang moves bytes: small storage batches one after another, then a separate copy to the GPU.
The setup
One Qwen2.5-7B-Instruct server on SGLang 0.5.15.post1 with HiCache, KVStash as its storage tier, the daemon on the same host over loopback TCP. The prompt was 110,016 tokens, stretched past the model's native context with YaRN x4. At 57,344 bytes per token in BF16 that is 6.31 GB of KV cache in 3,436 blocks.
Before every timed read we flushed SGLang's GPU and host caches and checked that the flush succeeded, so the prefix could only come from KVStash. We asked for one output token, so time to first token is the whole request.
Time to first token, by where the prefix came from
- GPU cache hit (SGLang radix cache)The floor: tokenizing the text prompt and scheduling.0.26 s
- SGLang host memory (its own tier)One copy: host memory to GPU. One sample of 0.93 s on the second machine.0.51-0.59 s
- KVStash, old adapter defaults: 8 connections, 4 parallel fetches11 to 12.5x faster than recompute: the number this post explains.1.56-1.76 s
- KVStash, 16 connections, 16 parallel fetches, stock SGLangNow the adapter default.1.04-1.08 s
- KVStash, 32/32, SGLang batch constant patched to 2048Whole prefix in one request. Slower on another machine (below).0.87 s
Finding 1: our client defaults were the 12x
The adapter opened 8 connections and sent 4 fetch requests in parallel. Four fetches in flight could not keep the link busy: SGLang's storage reads ran at about 5.5 GB/s. With 16 connections and 16 parallel fetches, the same read took 1.04‑1.08 s on that machine, with no other change. 32 and 32 gave the same result, so 16 and 16 became the default in the sglang-kvblockd adapter.
The first number we would have published was set by a default nobody had measured.
This is the least interesting finding and the most useful one.
Finding 2: SGLang reads storage in small serial batches
SGLang asks its storage tier for 128 pages at a time and waits for each batch before sending the next. The size is a constant in its code, STORAGE_BATCH_SIZE in hicache_storage.py, not a setting. A 110k-token prompt is about 1,719 pages of 64 tokens, so the read is 14 round trips in a row.
To measure what that costs, we patched the constant to 2048 so the whole prefix went in one request. On the profile machine the read dropped to 0.87 s. On the machine we used for the prompt-length sweep, the same change made the 110k read slower: 2.73 s against 1.52 s with the stock constant.
This measures what batching costs on one machine, not a setting to copy. A configurable batch size in SGLang would let each deployment pick its own.
Run r20261029-sweep1: one L40S, default KVStash settings, 110,016-token prompts, median of 5, 29 Oct 2026. Same constant change as the profile machine, opposite result.
Finding 3: the rest is two copies in a row
With the batching removed, the request fits a three-term sum. SGLang does the two copies one after the other; its own host-memory tier skips the first copy, which is why it was faster on this prompt while it still held the prefix.
Where 0.87 s goes, and what overlap would save
- Tokenize and schedule: 0.260 s
- KVStash to host memory, 17.8 GB/s: 0.354 s
- Host memory to GPU, about 25 GB/s: 0.252 s
Overlapping the fetch with the copy to the GPU needs a change in SGLang, such as loading layer by layer while the rest arrives, not in the store. The store did its part on every row: each KVStash read served 6.31 GB in 3,436 hits with 0 misses and 0 aborts, and SGLang reported 109,952 tokens from storage.
Finding 4: one machine is an anecdote
Later the same day, the prompt-length sweep on another L40S read the same 110k prompt in 1.52 s with the new defaults, not 1.05 s. We suspected the store got slower as it filled, so we read the same prompts in one container with 19 GB and then 51 GB stored: 1.49-1.52 s both times. The store was not slower when fuller. The difference was the machine.
What we changed about measuring
- Verify the flush. Our first profile runs ignored a failed cache flush, and 3 of 9 repeats were silently served from the GPU cache. The harness now waits for the flush, records whether it succeeded, and logs the engine's tokens-from-storage count next to every timing.
- Discard the first request after a server start. It was about 0.25 s slower (warm-up); the profile figures quote requests 2 and 3.
- Repeat across machines before quoting. The fastest of eight separate runs read the prompt in 1.05 s against a median of about 1.45 s.
The full method is in how we measure cache value.
Where it stands
At 110,016 tokens on one L40S with stock SGLang and default settings, reading the prefix from KVStash gave 13‑19x faster time to first token than recomputing, across 8 runs on separate machines (median about 14x). By prompt length on one machine: 8k 5.3x, 32k 8.0x, 64k 10.6x, 110k 13.7x.
SGLang 0.5.15.post1, Qwen2.5-7B-Instruct BF16, one L40S, KVStash on the same host, default settings, median of 5 reads per point after a verified cache flush. Run r20261029-sweep1, 29 Oct 2026.
The store is not the limit on this path. The next gain is in how the engine moves bytes onto the GPU: overlapping the two copies, and letting deployments size the storage batch. Both are SGLang changes. The study with every table is SGLang long-prompt TTFT.