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

All three passes. On the first pass nothing is stored yet, so p99 is about the same in both modes (8.99 s and 9.05 s).
PassModeTTFT meanp50p99Input tokens/sPrompt reused
First passconcurrency 16SGLang cache3.17 s2.99 s8.99 s20,03354%
SGLang cache + KVStash1.88 s0.99 s9.05 s28,81874%
Second passconcurrency 4SGLang cache0.78 s0.80 s2.18 s14,44961%
SGLang cache + KVStash0.13 s0.12 s0.24 s23,63899%
After a server restartconcurrency 16SGLang cache3.08 s2.94 s9.02 s19,93954%
SGLang cache + KVStash0.34 s0.32 s0.80 s60,83599%
  • 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

L40S, the full 512-request workload of Figure 1, SGLang cache + KVStash, 29 Oct 2026. KVStash reported 0 misses with either 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

All three passes, 96 requests each.
PassModeTTFT meanp50p99Input tokens/sPrompt reused
First passconcurrency 16SGLang cache6.77 s6.68 s12.91 s39,86530%
SGLang cache + KVStash5.16 s3.45 s12.66 s49,66250%
Second passconcurrency 4SGLang cache1.27 s1.18 s3.21 s37,88235%
SGLang cache + KVStash0.54 s0.51 s1.35 s101,52595%
After a server restartconcurrency 16SGLang cache6.35 s6.44 s12.54 s40,03230%
SGLang cache + KVStash2.53 s2.25 s4.66 s93,62681%
  • 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.

Several SGLang servers sharing one KVStash

SGLang's own cache belongs to one server. With a shared store, a prefix computed on one server can be read by another.

Figure 5Server B, after server A computed the same prompts, H100

Server B, one pass of 128 prompts per mode.
ModeTTFT meanp50p99Input tokens/sPrompt reused
SGLang cache only2.50 s2.44 s4.08 s40,72534%
SGLang cache + KVStash1.65 s1.62 s3.12 s58,76873%
  • Server A computes 128 prompts with 8k-token shared prefixes; server B (separate process and GPU memory, same machine) then receives the same prompts.
  • Server B shown.
  • One H100, both servers and the store on the same machine, SGLang host-memory pool 8 GB, 29 Oct 2026.
  • Without a shared store, B cannot use what A computed.
Three servers, one store

Three SGLang servers on one H100 machine sharing one KVStash on the same host (no network between them): the two servers reading what the first computed got 1.8-1.9x requests per second and 4x lower p99 TTFT, 98.5% of prompt tokens cached, 0 errors. With too little store memory they fell back to normal speed without errors (run r20261029-shared3b).

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

  1. 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.
  2. 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.
  3. 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

  1. 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.
  2. Run SGLang's bench_serving shared-prefix workload: a first pass at concurrency 16, then a second pass at concurrency 4.
  3. Restart the SGLang server (its GPU and host caches start empty), keep the KVStash daemon running, and run the workload again at concurrency 16.
  4. Record time to first token (mean, p50, p99), input throughput and the share of prompt tokens reused, as reported by bench_serving and SGLang.
  5. 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.

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