cd /news/ai-infrastructure/sglang-vs-vllm-your-agent-is-slow-be… Β· home β€Ί topics β€Ί ai-infrastructure β€Ί article
[ARTICLE Β· art-155750] src=dev.to β†— pub= topic=ai-infrastructure verified=true sentiment=Β· neutral

SGLang vs vLLM: Your Agent Is Slow Because You Picked the Wrong Cache

A technical analysis of SGLang's RadixAttention versus vLLM's automatic prefix caching finds that SGLang's reported 11.57x time-to-first-token speedup (440ms to 38ms on Qwen2.5-Coder-32B-Instruct-AWQ) holds only for long-context, multi-turn agent traffic with heavy shared prefixes. Citing benchmarks including a 78.6% versus 41.2% KV cache hit rate at 75% prefix overlap, the analysis notes the advantage disappears on unique prompts, where SGLang and vLLM are functionally tied, and that vLLM led on raw throughput (23,500 vs 16,800 tok/s) for Qwen2.5-7B on a single H100.

by read4 min views5 publishedOct 23, 2026

If you serve LLM agents in production, you have probably seen this week's numbers: in a multi-turn agent workload with an 8,000-token system context, SGLang's RadixAttention cut time-to-first-token (TTFT) from 440ms to 38ms β€” an 11.57x speedup β€” while vLLM v0.6 with prefix caching managed 480ms down to 92ms, a 5.21x improvement (Qwen2.5-Coder-32B-Instruct-AWQ), as benchmarked by NextByteTech in their Dev.to post on ollama vs vLLM vs SGLang in 2026. The data is real, and the conclusion is mostly right: for long-context, multi-turn agent traffic, SGLang currently wins. But "mostly" hides the interesting part. Those speedups only materialize when your workload has the right shape. Run the same two engines against different traffic and the gap collapses β€” or flips. This post is the decision framework the benchmark post didn't give you: when RadixAttention genuinely pulls ahead, and when both engines tie.

Both vLLM's prefix caching and SGLang's RadixAttention reuse previously computed KV cache for repeated prompt prefixes. The difference is the data structure.

vLLM's automatic prefix caching (APC) historically hashes whole blocks of the prompt and matches them against cached blocks. It's effective when requests share long, identical prefixes β€” the classic system-prompt-plus-few-shot-template shape β€” but it degrades when prefixes diverge mid-sequence or when the overlap doesn't align to block boundaries.

SGLang's RadixAttention stores the KV cache in a radix tree (a compressed trie) over token sequences. Repeated prefixes become shared tree paths, and the cache can be reused at the granularity of any common prefix, not just aligned blocks. Multi-turn agent conversations are exactly this: the same 8,000-token system context plus growing conversation history, turn after turn. Each new turn shares a massive common prefix with the previous one. The tree reuses nearly all of it, which is why the reported TTFT dropped to 38ms β€” almost the entire prefill was skipped.

The second Dev.to comparison (ifnodoraemon's SGLang vs vLLM architecture showdown) makes the mechanism visible in the metrics: at a 4,096-token prompt with 75% prefix overlap and concurrency 64, SGLang hit a 78.6% KV cache hit rate vs vLLM's 41.2%, with median TTFT of 85ms vs 380ms (4.47x), P99 TTFT of 280ms vs 1,250ms, and throughput of 5,430 vs 3,120 tok/s. The hit-rate gap is the performance gap. When your workload is prefix-overlap-heavy, the radix tree's finer-grained reuse shows up directly in every latency percentile.

Here is where the story gets useful. Three published counter-cases show where the advantage evaporates.

bex.co's September 2026 report (SGLang Crossed 400,000 Production GPUs) benchmarked Llama 3.3 70B FP8 on Spheron H100s at 50 concurrent requests with unique prompts β€” traffic with no shared prefix to reuse. The result: SGLang at 1,920 tok/s vs vLLM at 1,850 tok/s, with TTFT within 20ms of each other. No shared prefix, no cache to share; the radix tree has nothing to work with, and the two engines are functionally tied.

The same bex.co report includes a May 2026 result on a single H100 with Qwen2.5-7B: vLLM delivered 23,500 tok/s of raw throughput vs SGLang's 16,800 tok/s β€” a clear vLLM win on aggregate tokens per second. SGLang still held a 4x+ TTFT advantage (1.8s vs 7.8s), so it wasn't a loss on every axis, but for a throughput-first, latency-tolerant batch workload, the "SGLang is faster" headline would have been wrong.

bex.co's DGX Spark concurrency sweep found SGLang winning at 1–4 concurrent requests, with vLLM winning at 6+ concurrent requests. And RunPod's blog on the SGLang vs vLLM KV cache comparison (2x H100, DeepSeek-R1-Distill-Llama-70B, 7k context) concluded that a cache hit yields roughly +20% speed β€” and that on fresh context the two engines are comparable. If your traffic is many short, independent prompts at high concurrency β€” the classic chatbot-serving shape β€” the radix tree overhead buys you nothing and vLLM's throughput engine takes the round.

Workload shape Winner (per published results)
Multi-turn agent, long shared system prompt (8k tokens), moderate concurrency SGLang, large margin (11.57x vs 5.21x TTFT speedup)
4k prompts, 75% prefix overlap, concurrency 64 SGLang (4.47x median TTFT, 2x KV hit rate)
Unique prompts, no shared prefix, 50 concurrent Tie (1,920 vs 1,850 tok/s, TTFT within 20ms)
Short prompts, throughput-first batch, 1x H100 vLLM (23,500 vs 16,800 tok/s raw throughput)
Short prompts, 6+ concurrency (DGX Spark) vLLM
Fresh context, no cache reuse (RunPod) Tie

Before you switch engines, measure your workload against these four questions:

The benchmark post's headline number β€” 38ms vs 92ms TTFT in the multi-turn agent scenario β€” is correct for that workload, and RadixAttention's radix-tree design is genuinely the better mechanism for shared-prefix traffic. But engines don't run benchmarks; they run your traffic. Unique-prompt serving, short-prompt batch throughput, and high-concurrency chatbot shapes all show the two engines tying or vLLM winning, per bex.co, RunPod, and the second Dev.to comparison. Measure your prefix overlap and concurrency first, then pick the cache that fits.

We write about production LLM infra and agent systems for builders shipping real products. Follow along here:

[https://t.me/qisuancloud](https://t.me/qisuancloud)

[https://qisuanai.com](https://qisuanai.com)
── more in #ai-infrastructure 4 stories Β· sorted by recency
── more on @sglang 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/sglang-vs-vllm-your-…] indexed:0 read:4min 2026-10-23 Β· β€”