SGLang under load with KVStash: restarts, shared stores and failures
After an SGLang server restart, p99 time to first token fell from 9.02 s to 0.80 s with KVStash holding the shared prefixes, against SGLang's own caches, which a restart empties. With the store killed mid-load, every request still completed. Memory and settings for each figure are in the setup below.
- SGLang 0.5.15.post1
- Qwen2.5-7B-Instruct, BF16
- One GPU per server
- Store on the same host
- NVIDIA L40S and H100
- 29 October 2026
Last updated
Results in brief
-
9.02 s→0.80 s
p99 time to first token after an SGLang server restart, L40S, 8k-token shared prefixes.
-
99%
Prompt tokens reused after the restart with KVStash, against 54% with SGLang's own cache alone.
-
512 of 512
Requests completed with the KVStash daemon killed mid-load. SGLang recomputed what it could not read.
- L40S, 8k-token shared prefixes, 512 requests, concurrency 16, SGLang 0.5.15.post1 + Qwen2.5-7B BF16, 29 Oct 2026, one pass.
- Both modes: SGLang host pool 48 GB.
- The KVStash side also has an 80 GiB DRAM store on the same machine that the baseline does not, and a raised response budget.
- With default settings, on a smaller workload (32 groups, two passes): mean 1.9 s to 0.5 s, p99 8.3 s to 1.2 s.
Load test setup
SGLang's own load generator against two identical servers, one with KVStash under it. The engine, model and store placement match Study 1a.
- Engine
- SGLang 0.5.15.post1 (official cu129 runtime image), HiCache with KVStash as the storage tier, page size 64
- Model
- Qwen/Qwen2.5-7B-Instruct (revision a09a3545), BF16 weights and KV cache (57,344 bytes per token), one GPU
- GPU
- One L40S 48 GB per server; one H100 80 GB for the 30k-prefix and shared-store runs, on Modal.
- Store
- KVStash daemon on the same host as the GPU server, reached over TCP (loopback), DRAM arena unless stated
- Load generator
- SGLang's own
bench_serving, generated shared-prefix workload: groups of requests that share a long prefix, each with its own question. - Working set
- Larger than the GPU and host caches together, so SGLang has to evict prefixes that KVStash can still serve.
- Modes compared
- SGLang cache: SGLang's GPU radix cache plus its host-memory HiCache. SGLang cache + KVStash: the same, with KVStash as the storage tier. That tier is extra memory the first mode does not have (a KVStash store in DRAM of 80 GiB in Figures 1 and 3, 85 GiB in Figure 4), so the comparison shows what a tier that survives restarts adds, not KVStash against another storage tier. SGLang's own file backend or another store under the same restart is not measured.
- Settings
- Figures 1, 3 and 4: SGLang host-memory pool 48 GB in both modes and the KVStash response budget raised. Figure 2: everything on defaults. Figure 5: see its caption.
SGLang load test on L40S: 8k-token shared prefixes
Three passes over the same 512 requests: store the prefixes, ask again, then ask after an SGLang restart that empties its GPU and host caches.
Figure 1Time to first token after an SGLang server restart, L40S
| Pass | Mode | TTFT mean | p50 | p99 | Input tokens/s | Prompt reused |
|---|---|---|---|---|---|---|
| First passconcurrency 16 | SGLang cache | 3.17 s | 2.99 s | 8.99 s | 20,033 | 54% |
| SGLang cache + KVStash | 1.88 s | 0.99 s | 9.05 s | 28,818 | 74% | |
| Second passconcurrency 4 | SGLang cache | 0.78 s | 0.80 s | 2.18 s | 14,449 | 61% |
| SGLang cache + KVStash | 0.13 s | 0.12 s | 0.24 s | 23,638 | 99% | |
| After a server restartconcurrency 16 | SGLang cache | 3.08 s | 2.94 s | 9.02 s | 19,939 | 54% |
| SGLang cache + KVStash | 0.34 s | 0.32 s | 0.80 s | 60,835 | 99% |
- SGLang bench_serving, generated shared-prefix workload: 8k-token prefixes, 128 groups x 4 questions, 512 requests per pass.
- One L40S, Qwen2.5-7B-Instruct BF16, SGLang host-memory pool 48 GB, KVStash response budget raised, store on the same host.
- SGLang cache = GPU radix cache + host-memory HiCache.
- One pass per row, 29 Oct 2026.
- KVStash: 0 misses, 0 aborts in every pass.
The same test with every setting on default
Figure 1 used a raised KVStash response budget and a larger SGLang host pool. A smaller rerun, after the fix described below, left both on their defaults.
Figure 2Default settings, L40S: SGLang cache against SGLang cache + KVStash
-
1.9 s→0.5 s
Mean TTFT
-
8.3 s→1.2 s
p99
-
3.1x
Requests per second
-
98.5%
Prompt tokens cached
-
0
Connection errors
- One L40S, SGLang 0.5.15.post1, Qwen2.5-7B-Instruct BF16, 8k-token shared prefixes, 32 groups x 4 questions, concurrency 16, two passes.
- KVStash daemon and SGLang adapter on default settings (no raised budgets), store on the same host.
- Run r20261029-correct1, 29 Oct 2026.
Why the host-memory pool size matters
SGLang copies everything it reads from a storage tier into its host-memory pool before moving it to the GPU. With a 16 GB pool, reuse stopped at 33-45% even though KVStash missed nothing: SGLang had nowhere to stage the rest. Size --hicache-size for your traffic. SGLang without KVStash also gains from a larger pool, which is why both modes in Figure 1 use the same size.
Figure 3Prompt tokens reused, by SGLang host-pool size
SGLang load test on H100: 30k-token shared prefixes
Longer prefixes, a faster GPU and fewer requests per pass. After the restart, mean time to first token fell from 6.35 s to 2.53 s.
Figure 4Time to first token after an SGLang server restart, H100
| Pass | Mode | TTFT mean | p50 | p99 | Input tokens/s | Prompt reused |
|---|---|---|---|---|---|---|
| First passconcurrency 16 | SGLang cache | 6.77 s | 6.68 s | 12.91 s | 39,865 | 30% |
| SGLang cache + KVStash | 5.16 s | 3.45 s | 12.66 s | 49,662 | 50% | |
| Second passconcurrency 4 | SGLang cache | 1.27 s | 1.18 s | 3.21 s | 37,882 | 35% |
| SGLang cache + KVStash | 0.54 s | 0.51 s | 1.35 s | 101,525 | 95% | |
| After a server restartconcurrency 16 | SGLang cache | 6.35 s | 6.44 s | 12.54 s | 40,032 | 30% |
| SGLang cache + KVStash | 2.53 s | 2.25 s | 4.66 s | 93,626 | 81% |
- One H100 80 GB, 30k-token shared prefixes, 96 requests per pass, host pool 48 GB, 29 Oct 2026.
- The 1,010 KVStash misses after the restart were capacity evictions (85 GiB arena, 77 GiB of prefixes), not errors; a larger arena removes them.
- SGLang 0.5.15.post1, Qwen2.5-7B-Instruct BF16, KVStash on the same host.
What happens when the KVStash store is killed mid-load?
SGLang treats anything it cannot read from KVStash as a miss and recomputes it, so a dead store costs speed, not requests.
Store killed (SIGKILL) during a 512-request load
512 of 512 requests completed; SGLang recomputed, at the speed of SGLang without KVStash.
Empty store after a restart
Requests served; cache refilled (64 of 64, 75% reuse).
Store too small for every prefix
In the H100 restart pass, the misses were served by recompute, not errors (Figure 4).
SGLang 0.5.15.post1, Qwen2.5-7B-Instruct BF16, L40S, 8k-token shared prefixes, 29 Oct 2026. More failure checks are in Study 1a.
A bug this load test found: the response budget
Under load, KVStash held every prefix SGLang asked for, yet only 31-37% of prompt tokens were reused. The daemon was dropping connections.
What went wrong
The daemon caps how many bytes of replies it holds in memory per tenant while they wait to be sent: the response budget, 256 MiB per tenant (512 MiB in total) by default. SGLang reads a long prefix in batches of 64 pages, about 235 MB each, and keeps several in flight, so the second batch usually found the budget full.
The daemon answered by closing the connection with a "busy" status. The client treated that as fatal, marked every page in the batch as a miss, and SGLang recomputed them: 16 to 141 dropped connections per pass.
What we changed
- For the load test: raised the response budget to 8 GiB. Dropped connections went from 141 to 0 on the same pass. Figures 1, 3 and 4 use this setting.
- In the daemon: when the budget is full, it now waits up to 5 s for earlier replies to drain instead of closing the connection. A reply larger than the whole budget is still refused at once.
- Checked on defaults: the rerun in Figure 2 used the fixed daemon with the default budget and had 0 connection errors.
Method and limits
How each pass was run, and what this study does not show.
Method
- Start one SGLang server per mode on the same GPU type, with the same host-memory pool size, and the KVStash daemon on the same host.
- Run SGLang's
bench_servingshared-prefix workload: a first pass at concurrency 16, then a second pass at concurrency 4. - Restart the SGLang server (its GPU and host caches start empty), keep the KVStash daemon running, and run the workload again at concurrency 16.
- Record time to first token (mean, p50, p99), input throughput and the share of prompt tokens reused, as reported by
bench_servingand SGLang. - Read the daemon's own counters (hits, misses, aborts) after every pass.
Limits of this study
- One pass per row: these are single runs, not medians of repeats. The second pass ran at concurrency 4, the first pass and the restart pass at 16.
- The KVStash mode has more total memory than the SGLang-only mode: its store adds 80 GiB of DRAM in Figures 1 and 3, 24 GiB in Figure 2, 85 GiB in Figure 4 and 40 GiB in Figure 5.
- The default-settings rerun in Figure 2 is a smaller workload (32 groups, two passes), so it is not directly comparable with Figure 1.
- One model (7B, BF16), one GPU per server, tensor parallel 1.
- KVStash on the same host as the GPU servers over loopback TCP; no network hop between machines.
- DRAM tier only. The NVMe and S3 tiers were not part of the load test.
- Figures 1, 3 and 4 used a raised response budget and a 48 GB host pool; Figure 2 is on defaults.
- Generated prompts from
bench_serving, not production traffic.
Download the data
Generated from the same source as this page. Captions and setup are in the JSON file.
Questions about this study
Changelog. 4 November 2026: first published, runs from 29 October 2026. 9 November 2026: stated the extra DRAM the KVStash mode had in each figure, that rows are single passes at different concurrency, and that the default-settings rerun is a smaller workload.
How much faster is SGLang after a restart with KVStash?
In our L40S load test with 8k-token shared prefixes, mean time to first token after a server restart fell from 3.08 s to 0.34 s and p99 from 9.02 s to 0.80 s, because 99% of prompt tokens came back from KVStash instead of being recomputed. On an H100 with 30k-token prefixes the mean fell from 6.35 s to 2.53 s.
What happens to SGLang if the KVStash store crashes under load?
SGLang recomputes what it cannot read, as it would without KVStash. We killed the daemon with SIGKILL during a 512-request load: 512 of 512 requests completed; SGLang recomputed. A restarted, empty store then served requests and refilled.
Can several SGLang servers share one KVStash store?
Yes. With two servers, server B reused what server A computed: mean time to first token 2.50 s without a shared store and 1.65 s with one. With three servers on one H100, the two reading servers got 1.8-1.9x requests per second and 4x lower p99.
Do I need to change SGLang settings to use KVStash?
Size SGLang's host-memory pool (--hicache-size) for your traffic: SGLang stages everything it reads from a storage tier through that pool. With a 16 GB pool reuse stopped at 33-45% in our test even with no KVStash misses; with 48 GB it reached 99%. KVStash's own defaults handled the load after the fix described on this page.
What was the bug found in this test?
Under load, the daemon closed connections when its per-tenant reply buffer (256 MiB by default) filled up, because one SGLang read batch is about 235 MB and several are in flight. The client turned each closed batch into misses. The daemon now waits up to 5 s for the buffer to drain instead, and the default-settings rerun had 0 connection errors.
Restarts and autoscaling on your fleet?
Tell us how often your servers restart or scale, and how long your shared prefixes are. We will say what a warm restart could look like for you.
Or write to rudray@kvstash.com