Skip to content

[Blog]: Bringing First-Class SGLang Serving to llm-d - #530

Merged
ahg-g merged 14 commits into
llm-d:mainfrom
tyuchn:blog/sglang-glm-5-2-wide-ep-kv-tiers
Nov 22, 2026
Merged

ahg-g merged 14 commits into
llm-d:mainfrom
tyuchn:blog/sglang-glm-5-2-wide-ep-kv-tiers

Conversation

@tyuchn

@tyuchn tyuchn commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds "Bringing First-Class SGLang Serving to llm-d" (blog/2026-11-02_serving-glm-5-2-sglang-tiered-kv-cache-on-llm-d.mdx) with four figures (static/img/blogs/glm52-sglang-tiered-kv/). Building on Serving GLM-5.2 for Agentic Workloads on llm-d without repeating its trace and MLA fundamentals, the post covers three parts on the SGLang variant of the GLM-5.2 well-lit path:

  1. Engine-agnostic llm-d architecture: How llm-d decouples DisaggregatedSet orchestration, per-DP-rank InferencePool endpoint discovery, and EPP prefix-affinity routing from individual model servers so vLLM and SGLang share one Kubernetes operational stack.
  2. First-class SGLang integration: How the llm-d and SGLang communities adapted SGLang's Wide-EP runtime to act as independent, routable, and observable Kubernetes endpoints across per-rank Rust HTTP servers, replicated P/D pairing state with Linux DMA-BUF RDMA transfers, and per-rank cache/trace metadata.
  3. Tiered KV-cache offloading (L1 → L2 → Shared L3) and multi-replica performance: Evaluating SGLang's HiCache across single-replica 16x H200 and multi-replica 32x H200 deployments under sustained concurrency sweeps, live prefill pod eviction/failover, and cold-replica recovery.

Key Figures Preview

Engine-Agnostic Architecture & SGLang Wide-EP

Single-Replica Tiered Offloading Scaling

Multi-Replica Shared L3 Failover and Scale-Out

Why is this change needed?

Documents the community effort that brought first-class SGLang Wide-EP serving to llm-d (llm-d/llm-d#2198) and provides measured guidance for configuring HiCache across single- and multi-replica clusters:

  • Single-replica L2 host RAM (16x H200): Eliminates the L1 HBM thrashing cliff past concurrency 32 (6.0% hit and 174.2 s median TTFT at c128 on L1 alone), keeping cache hit rates at 85%–95%, cutting c128 median TTFT 8.7x (20.1 s), and raising output 3.94x (1,257 tok/s).
  • Multi-replica scale-out & Shared L3 (32x H200): Scaling to two prefill replicas with a 2-node decode pool cuts c128 median TTFT 5.9x (3.43 s, 1,903 tok/s output). Adding Shared L3 (hicache-fs on a ReadWriteMany PVC) restores 99.94% of evicted session prefixes (1.08M tokens) from storage on the surviving replica during live pod failover — cutting failover median TTFT by 25% (38.4 s → 28.8 s) and survivor queue recovery time in half — and cuts cold-replica recovery TTFT by 57% (38.8 s → 16.8 s).

How was this tested?

  • Site builds successfully (npm run sync && npm run build)
  • Author and tag YAML validated without duplicate keys
npm ci
npm run sync
npm run build

Checklist

  • Commits are signed off (git commit -s) per DCO
  • Code follows project contributing guidelines
  • Site builds without errors (npm run build)
  • Documentation updated (if applicable)

Related Issues

@netlify

netlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

👷 Deploy request for llm-d pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 80b8560

@tyuchn
tyuchn force-pushed the blog/sglang-glm-5-2-wide-ep-kv-tiers branch from 45c59bb to a52bcad Compare October 31, 2026 21:36
@tyuchn tyuchn changed the title [Blog]: Serving GLM-5.2 on SGLang with llm-d: Extending Wide-EP Prefix Caching to Host DRAM and Shared Storage [Blog]: Serving GLM-5.2 on SGLang with llm-d: Wide-EP Tuning, Host DRAM, and Shared Storage Oct 31, 2026
@tyuchn tyuchn changed the title [Blog]: Serving GLM-5.2 on SGLang with llm-d: Wide-EP Tuning, Host DRAM, and Shared Storage [Blog]: Serving GLM-5.2 on SGLang with llm-d: Wide-EP, Host DRAM, and Shared Storage Nov 3, 2026
@tyuchn

tyuchn commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/assign @zetxqx
/assign @sagearc
/assign @ahg-g

Add "Serving GLM-5.2 on SGLang with llm-d: Wide-EP, Host DRAM, and
Shared Storage" with six figures. The post benchmarks the SGLang variant
of the GLM-5.2 well-lit path (v0.5.23, DEP8 prefill + DEP8 decode on
16x H200) across a three-tier KV cache: L1 GPU HBM, L2 host DRAM
(HiCache) and shared L3 storage (hicache-fs on a ReadWriteMany volume).

It answers two questions with 900 s aiperf sweeps and paused multi-turn
replays: when each KV tier helps and by how much (L1 alone thrashes
past concurrency 32; host DRAM raises c128 output 3.94x; shared storage
costs 14-33% median TTFT in steady state but restores cold ranks and
restarted pods 49-57% faster than recomputing), and how SGLang compares
with the earlier vLLM wide-EP runs under the same protocol, labeled
indicative with the cluster, fabric, build and router differences
spelled out. A sizing table maps agentic workload scenarios to tier
sizes.

Authors: tyuchn, nishjain, zetxqx and sagearc (the last two built the
upstream SGLang wide-EP recipe the post extends). Adds the gke tag.

Supersedes llm-d#490.

Signed-off-by: Yuchen Tian <[email protected]>
@tyuchn
tyuchn force-pushed the blog/sglang-glm-5-2-wide-ep-kv-tiers branch 2 times, most recently from 8f56d41 to 2dcaf3c Compare November 3, 2026 19:37
Remove the deployment-details appendix (cluster, node, driver and
version table), which was specific to the GKE testbed. Keep the
cloud-agnostic part, the AIPerf invocation behind every load-sweep
number, as the last step of 'Running the recipe'.

Signed-off-by: Yuchen Tian <[email protected]>

@zetxqx zetxqx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together! A few high-level thoughts before the line-level comments:

  1. Overlap with the earlier post. This post covers much of the same ground as Serving GLM-5.2 for Agentic Workloads on llm-d: same model, hardware, trace, and benchmark protocol, and the same conclusions on the traffic shape, MLA/DEP memory fit, CPU/DRAM offloading, MTP, and prefill being the bottleneck. The new part is Shared L3. cc @ahg-g: do we want to reshape this post around what's new, or add more distinct value before publishing?

  2. vLLM comparison. I'd drop it entirely: the comparison section (L192-223) and Figure 5, the TL;DR bullet (L49), the vLLM reference in Figure 2 / L127, and the engine A/B item in "Where this goes next". llm-d is engine-neutral, and I don't think we want to run engine-vs-engine comparisons in our blog.

  3. Showing the value of Shared L3. The steady-state load sweep isn't the best fit: there, L3 mostly adds write-through overhead on top of L2. L3 helps when local tiers are empty or out of reach, so these cases would show its value more directly:

    • Cold start: a new or restarted prefill pod serving returning sessions.
    • Scale-out: adding a prefill replica mid-run and measuring how quickly it serves warm prefixes.
    • Rolling upgrades or Spot preemption during a sustained run.
    • Cross-replica routing: sessions landing on a replica that has never seen them (for example multi-replica p2w1d1w2).
    • Long-idle resumes: sessions that come back after their prefix was evicted from host DRAM.

    The cold-DRAM recovery runs (-49%–57% TTFT) are a good start; a TTFT time series around a restart or scale-out event would make the case clearer.

@tyuchn

tyuchn commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review @zetxqx! I updated the two inline comments in f6bb8c7 (and merged main to resolve the authors.yml conflict).

On (3), just in case it got buried after the aiperf sweep, we do cover the paused multi-turn Weka trace replay and cold-DRAM / post-restart L3 recovery in Paused multi-turn sessions and cold-DRAM recovery from Shared L3. That said, your suggestions on showing dynamic L3 scenarios — like a TTFT time series across a prefill restart/preemption or scale-out / cross-replica routing — are really good points, and we're getting more numbers prepared along those lines.

I'll check with @ahg-g on the structural questions in (1) and (2) before reshaping the sections.

@sagearc sagearc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work @tyuchn !
left few comments, in general this is a real milestone and the blog is truly valuable. I think we could improve on clarity, shared few examples in the comments below :)

@sagearc

sagearc commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

@zetxqx good points, strongly agree with 1

@tyuchn

tyuchn commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks again for the thoughtful reviews @sagearc @zetxqx! Pushed 274c378 to address both sets of feedback:

  • Trimmed overlap & dropped the vLLM comparison: Removed the repeated Weka trace distribution / MLA tutorial material covered in the earlier GLM-5.2 post, and dropped the vLLM comparison section, Figure 5, TL;DR bullet, Figure 2 reference, and engine A/B item.
  • Two-part problem-first arc: Opened directly with the cache-persistence problem and organized the post into (1) Supporting GLM-5.2 Wide-EP on SGLang with llm-d (including the DEP8 stack, memory fit, and MTP) and (2) Tiered KV offloading: host DRAM and when Shared L3 is worth it (framing sustained-load write-through cost against paused sessions and cold-DRAM / pod-restart recovery).
  • Prose clarity & metric precision: Decluttered inline flags/parentheticals while keeping exact numbers in the tables, clarified the 6.6x MTP interactive comparison (c64 vs. c16 above 30 tok/s/user, vs. 1.15x–1.62x at matched concurrency) and the c128 queue-return effect, and noted that the 350-session 82.21s L3 median reflects only the 55 turns completed within the 449s window.

PTAL when you get a chance!

Comment thread blog/authors.yml Resolved
…replica L3, and co-authors

Signed-off-by: Yuchen Tian <[email protected]>
@tyuchn tyuchn changed the title [Blog]: Serving GLM-5.2 on SGLang with llm-d: Wide-EP, Host DRAM, and Shared Storage [Blog]: Bringing First-Class SGLang Serving to llm-d: Engine-Agnostic Routing, Disaggregated Wide-EP, and Tiered KV Cache Offloading Nov 17, 2026
@tyuchn tyuchn changed the title [Blog]: Bringing First-Class SGLang Serving to llm-d: Engine-Agnostic Routing, Disaggregated Wide-EP, and Tiered KV Cache Offloading [Blog]: Bringing First-Class SGLang Serving to llm-d Nov 17, 2026

@ShangmingCai ShangmingCai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great E2E PoC blog. No other comment, just some minor issues.

| :--- | :--- | :--- |
| **One node-level port hid eight separate KV caches behind a single endpoint.** | Leveraged the embedded Rust HTTP server for each DP rank with per-rank warmup readiness. | Every DP rank across single- and multi-node pools is a routable `InferencePool` endpoint. |
| **`P/D` pairing only worked on rank 0; routing to any other rank failed during the handshake.** | Replicated `P/D` pairing state across all rank listeners, carried routing metadata across OpenAI and native APIs, used standard Linux `DMA-BUF` RDMA for KV transfers, and added clean decode cancellation on prefill failure. | `EPP` can pair any prefill rank with any decode rank across nodes on standard GPU nodes. |
| **Operators and routers lacked per-rank visibility into serving and cache hits.** | Surfaced `cached_tokens` in responses, correlated `P/D` traces and logs across nodes, and added DP-aware KV-event handling in `EPP`. | Per-endpoint visibility in logs and traces, supporting zero-scrape approximate routing today and preparing exact KV-event tracking. |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For OpenAI usage, might need --enable-cache-report to enable this?

@tyuchn tyuchn Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the Rust server path (SGLANG_RUST_SERVER=1): --enable-cache-report isn't wired on its OpenAI endpoints yet, and sgl-project/sglang#43365 (for native /generate cached_tokens metadata) is still open, so in our benchmarks we read cache hits from the prefill scheduler logs. Updated this row in 3fe9915 to reflect what actually shipped (/server_info metadata parity, correlated P/D logs and traces, and SGLang KV-event decoding in EPP).

@zetxqx @sagearc to correct me if I'm wrong

@tyuchn
tyuchn force-pushed the blog/sglang-glm-5-2-wide-ep-kv-tiers branch from 048613e to 5b06a7a Compare November 18, 2026 00:48
@tyuchn
tyuchn force-pushed the blog/sglang-glm-5-2-wide-ep-kv-tiers branch from 5b06a7a to 3fe9915 Compare November 18, 2026 01:01

@ahg-g ahg-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great post overall. The architecture, recipes, and benchmark claims hold up well. Left a few inline comments (including regenerating Figure 1 and deduping authors.yml).

Comment thread blog/authors.yml
socials:
github: https://github.com/jtechapps

tyuchn:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of the authors already exist in the authors.yml list, please dedup

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 33064d0: removed the duplicate ahg-g entry and switched the frontmatter to abdullahgharaibeh (the other 6 entries are new).

<!-- reading-time-exclude:end -->

<Figure
src="/img/blogs/glm52-sglang-tiered-kv/topology-tiered-architecture.png"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regenerate Figure 1 to remove "Surfaces cached_tokens in responses" from the Per-Rank Observability card, and update routing-proxy (:8000->:8200) to (:8000-8007->:8200-8207).

Why: The Section 2 table was updated in 3fe9915 because cached_tokens is not yet wired on the Rust server OpenAI or native /generate paths, so Figure 1 currently contradicts the text and shipped behavior. Showing all eight proxy ports also matches --data-parallel-size=8 and InferencePool (:8000-8007/pod).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 33064d0: regenerated Figure 1 with (:8000-8007->:8200-8207) on routing-proxy and updated the Per-Rank Observability card to match Section 2.


* **Declarative disaggregated orchestration:** Multi-node prefill and decode pools run as native Kubernetes workloads through `DisaggregatedSet`, with coordinated gang scheduling, rolling updates, and Dynamic Resource Allocation for GPUs and RDMA NICs. Scaling from a single-replica `16`-GPU deployment to multi-replica `32`- or `64`-GPU Wide-EP pools uses the same declarative overlays and operational lifecycle across engines.
* **Per-DP-rank `InferencePool` endpoint discovery:** Rather than exposing a multi-GPU pod as one aggregated endpoint, `llm-d` registers each attention-DP rank as its own `InferencePool` endpoint, following the design from the [earlier GLM-5.2 post](/blog/serving-glm-5-2-agentic-workloads-on-llm-d#fitting-repository-scale-sessions-in-memory). This lets the router see and target each GPU's separate KV cache directly.
* **Pluggable `Endpoint Picker` (`EPP`) routing pipeline:** Fronted by Envoy and the Kubernetes Gateway API, the `EPP` inference router parses each request and tracks, per rank, which prefixes are cached and how many tokens are in flight. It sends prefill requests back to the rank that holds the warm prefix, spreads decode requests by active request count, and coordinates the prefill-to-decode transfer.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify that EPP selects the prefill and decode endpoints while the decode routing-proxy sidecar coordinates the prefill-to-decode transfer.

Why: EPP runs in the control path and sets the prefill target header, whereas routing-proxy on the decode pod performs the SGLang P/D bootstrap handshake and dispatches both legs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 33064d0: clarified that EPP selects the prefill and decode ranks while the decode routing-proxy sidecar runs the P/D handshake and dispatches both stages.

<strong>Figure 3:</strong> L2 host RAM eliminates the L1 thrashing cliff on a single 16-GPU replica.
</Figure>

Past concurrency `32`, active sessions exceed the `2.09M`-token `HBM` budget and evict one another, dropping the cache hit rate to `6.0%` and pushing median TTFT to `174.2 s` at concurrency `128`. Offloading to `L2` host RAM preserves `85%–95%` cache reuse across the full sweep, cuts concurrency-`128` median TTFT **`8.7x`**, and raises output **`3.94x`**—whereas adding `Shared L3` on a single warm pod pays network filesystem read, metadata, and backup overhead, raising median TTFT by `~26%–30%` and trimming concurrency-`128` output by `~9%` for no significant extra benefit.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qualify the Shared L3 steady-state overhead with the tested file backend settings (write_through + wait_complete), and verify whether the 1P1D range should read +14%–33% (full c16–c128 sweep) or state the concurrency points.

Why: Without naming write_through and wait_complete, readers can attribute the +26%–66% TTFT overhead to all Shared L3 backends or async/timeout prefetch policies. On 1P1D, c64 in Figure 3 is also slightly above 30% (3.8 s vs ~5.0 s).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 33064d0: qualified the Shared L3 overhead with our file backend settings (write_through backups + synchronous wait_complete prefetches) and updated the 1P1D range to 14%-33% across concurrencies 16 to 128 (+14.4% at c16, +25.9% at c32, +32.6% at c64, +29.6% at c128).


### Multi-replica Shared L3 on 32x H200

`Shared L3` pays off across multi-replica failover, pod evictions, and cold restarts. To test this, we scale out to `32` H200 GPUs across two 8-GPU prefill pods and one 2-node 16-GPU decode pool. We measure both sustained load at `64` and `128` concurrent sessions and a live failover test: with `24` active `~98K`-token sessions split across `prefill-0` with `11` sessions and `prefill-1` with `13` sessions, we delete `prefill-0` at `t = 95 s` so `EPP` moves all `11` of its sessions onto `prefill-1`:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add one sentence describing the cold-replica recovery test (16 sessions of ~92K tokens replayed against a freshly restarted prefill pod) and note that the 26% to 66% L3 overhead spans c64 and c128.

Why: Both the TL;DR and Section 3 headline the 57% cold-start TTFT drop (38.8 s -> 16.8 s), but the prose never explains what the cold-start experiment measured. Figure 4 also only plots c128 (+66%), leaving the 26% lower bound unanchored without naming c64.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 33064d0: added the cold-replica recovery setup (16 ~92K-token sessions replayed against a freshly restarted prefill pod) and anchored the 26% and 66% steady-state overhead to concurrencies 64 and 128.

@ahg-g

ahg-g commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

/approve

Thanks!

@github-actions github-actions Bot added the approved Approved blog post ideas. `triage` label should be removed label Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ahg-g
ahg-g merged commit d420bd7 into llm-d:main Nov 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved blog post ideas. `triage` label should be removed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants