Unit 10 of 11 · about 5 hours · explain, implement
Cancellation, timeout, retry and failure across phases and ranks
A client timeout does not stop every rank or an already submitted remote write. Recovery must terminate the logical request while retaining physical buffers until late work can no longer corrupt reused memory.
You'll be able to
- Implement cancellation and deadline propagation through router, prefill, transfer and decode ownership states.
- Fence retries and late callbacks so one logical request cannot install stale KV or emit duplicate tokens.
- Diagnose rank death, missing transfer fragments and stale worker discovery from a correlated request and ownership trace.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Failure boundaries of an in-flight transferTensorRT-LLM Disaggregated Serving and KV Cache Exchange
Introduction to KV Cache Transmission, TensorRT-LLM commit cc63e66: Workflow, steps 4 to 6; Current Limitations - submitted operations cannot be aborted (page read 2026-10-14)
The page explicitly leaves ambiguous-failure and cancellation retirement incomplete. Design and test the stronger servelab contract rather than assuming this engine already guarantees it.
- Heartbeat, waiting and cleanup budgetsSGLang documentation - PD Disaggregation
PD Disaggregation: Mooncake - Advanced Configuration - Prefill Server Configuration and Decode Server Configuration (page read 2026-10-14)
Read bootstrap and waiting timeouts, heartbeat health detection and the warning that longer bootstrap timeouts delay cleanup after lost decode connectivity. Skip launch and tuning snippets; model these events on CPU without importing the page's defaults as your SLO.
- Disaggregation can propagate failureDistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM Serving
arXiv:2401.09670v3, Section 4.3 Online scheduling - Preemption and fault tolerance
This paragraph discusses future work, not an implemented fault-tolerance protocol. Use it to identify dependencies your handoff tests must cover.
Focus on
- Build on Streaming, cancellation, failure and cleanup states and ownership invariants, and Rank-aligned timelines, stragglers, congestion and partial failure. Add the phase boundary and attempt identity to those existing invariants.
- A logical terminal state is absorbing: no late callback may revive it or emit output. Physical retirement is separate; an in-flight one-sided write may still target quarantined destination memory until completion or safe transport teardown.
- Propagate the remaining end-to-end deadline, not a fresh full timeout at each hop. A heartbeat can mark a worker unavailable; it cannot prove whether the request committed, whether bytes arrived or whether a retry is safe.
- A TP/PP rank failure can invalidate its serving group. Cancel or fail the dependent request, rebuild suspect communication state, and choose recomputation or replay only under a declared streaming contract. Correlate logical request, attempt, worker generation, collective sequence and KV ownership.
Common mistakes · 3
- Equating client cancellation with transport abort. Freeing destination pages while a remote write can still arrive turns a cancelled request into another request's corruption.
- Retrying with the same attempt and worker generation after restart. Delayed control messages can then bind old KV to the new allocation.
- Claiming exactly-once generation from deduplicating requests. A client may already have received tokens before failure; replay needs an explicit offset or a visible failed-stream contract.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.A transfer completes after its request was cancelled. What should happen?Answer
The completion may retire quarantined physical resources, but must not publish KV, resume decode or emit output for the terminal request.
2.Does a failed heartbeat prove a request did no work?Answer
No. It indicates failed health communication. Work may have completed and its acknowledgement may be lost, so retries need attempt fencing and an explicit outcome contract.
3.Why can one dead TP rank fail otherwise healthy ranks' requests?Answer
Their forward passes depend on matched collectives with that rank. Remaining ranks cannot independently finish the distributed model output.
4.How do you distinguish a stale payload from duplicated delivery of a valid completion?Answer
Check attempt, worker generation and KV identity first, then the current transition state. An old attempt is rejected; a repeated completion for an already completed live transition is idempotent and must not double-free or republish.
You're done when
Each injected fault reaches one logical terminal outcome, late events cannot revive it, and every allocation is either safely retired or explicitly quarantined with a bounded recovery path.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 10 more in the section
- DistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM ServingPeking University and Microsoft Research · primary
Read the interference model, independent phase parallelism, placement, KV transfer and goodput evaluation. Reuse the break-even method with your workload and topology; do not transfer the paper's speedups to different hardware.
- TensorRT-LLM Disaggregated Serving and KV Cache ExchangeNVIDIA · required
Study the KV exchange abstraction, unique request identity, layout conversion, overlap and fleet-worker model. Use its reproducible benchmark sections only on supported hardware and pin the release.
- SGLang documentation - PD DisaggregationSGLang Project · support
Use the transfer backends, router integration, heartbeat, timeout and cleanup behavior as a second engine's view of the same handoff.
Also in this section
- AI Systems Performance Engineering - Chapters 15 and 17, distributed and disaggregated inferenceChris Fregly (O'Reilly) · required
Read the disaggregated prefill and decode architecture and the MoE parallelism strategies in Chapter 15, then Chapter 17 on disaggregated pools, routing policies and scalability. Reproduce every communication and KV-transfer estimate for a small declared topology.
- AI Systems Performance Engineering companion code - Chapters 15 and 17Chris Fregly · required
Use the single-device KV-handoff and simulation paths before the multi-GPU pairs. Then choose one disaggregation, routing or MoE target compatible with available hardware and keep bundled results separate from newly captured evidence.
- Hands-On LLM Serving and Optimization - Chapter 7, multi-GPU and disaggregationChi Wang and Peiheng Hu (O'Reilly) · support
Read "Multi-GPU and Multi-Node Inferencing" (data, tensor, pipeline and expert parallelism) and "Prefill-Decode Disaggregation" (architecture, KV transfer, when to use it) in Chapter 7.
- NVIDIA Dynamo - Disaggregated Serving and KV-Aware RoutingNVIDIA · required
Trace frontend, prefill router, prefill worker, KV transfer, decode routing and decode worker. Record how load, cache overlap, worker discovery and transfer metadata affect placement; implement only a small simulated or available-hardware slice.
- Mooncake: A KVCache-Centric Disaggregated Architecture for LLM ServingMoonshot AI · support
Read the KV-centric architecture, transfer engine and scheduling sections to understand remote cache pools. Compare its assumptions with DistServe and your simpler handoff; defer reproduction requiring a large cluster.
- 100 Days of LLM Inference - Days 12, 17 and 18Elizabeth Thomas · support
Use the Dynamo, model-parallelism and disaggregation notebooks for a compact topology simulator and request-handoff trace. Label notebook outputs as local analytical or simulated evidence unless real devices were used.
- TensorTonic Language Modeling from Scratch - Route Cache-Aware Prefill RequestsTensorTonic · support
Solve after the routing unit and compare its cost rule with your own placement model.
- LLM Inference: From scratch, one token at a time - Module 09Tushar Amrit · support
Work the Distributed Inference module's communication arithmetic before the tensor and pipeline parallel units.
- AI Performance Engineering - Distributed InferenceWafer · reference
A curated index. Use Section 5 only to find a distributed-serving paper the other entries lack.
- Python 3.14 hashlib - byte digests for KV integrity checksPython Software Foundation · reference
Usage and Hash Objects only: compute and compare a SHA-256 digest over a declared canonical KV payload. Add request/version checks separately; a byte digest is not cache compatibility or authentication.