GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
arXiv preprint

Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving

Kimi's serving stack schedules around the KV cache: separate prefill and decode pools, a cache pool in idle DRAM and SSD, early rejection under overload. About 75% more requests on real traffic.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2024
AUTHORS
Qin, Li, He, Zhang, Wu, Zheng, Xu
FROM
Moonshot AI, Tsinghua University
PUBLISHED
Jun 2024 · arXiv preprint
CITED BY
302Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 18% of this breakdown.

01

The paper in one minute

Mooncake is the serving platform behind Kimi, Moonshot AI's chat service, which is known for long contexts. The paper's argument: once prompts average thousands of tokens, the KV cache is the main object a serving system moves, stores and schedules around, so design the cluster around it.

Four design choices follow. Prefill and decode run on separate machines (as in DistServe and Splitwise), because prefill is compute-bound and decode is memory-bound, and a long prefill on a decode node stalls every user's next token. A distributed KV cache pool uses the GPU servers' otherwise idle CPU memory, DRAM and SSD, with blocks moved by RDMA, so a prefix computed once on any node can be reused anywhere. A global scheduler, Conductor, picks the prefill node for each request by estimating time to first token (TTFT) on each candidate: how much of the prompt it already has cached, its queue, and the time to fetch missing blocks from another node. Hot blocks get copied to more nodes as a side effect. Admission control under overload rejects a request before its prefill if the decode pool won't have room when the prefill finishes, using a prediction of decode load rather than its current value.

Results come from a model with LLaMA2-70B's architecture (not Kimi's model) on A800 nodes. Scheduling by cache cut mean TTFT from 92 s (random) or 60 s (least-loaded) to 6.3 s on 23,000 real requests. Against vLLM with the same instance count, Mooncake served 20% to 40% more on public datasets, 50% to 525% more on simulated long prompts, and about 75% more on replayed real traffic. The authors also released a one-hour, 23,608-request trace with hashed block IDs, the first public data for studying cross-request KV reuse.

THE IDEA, VISUALLY
KVCACHE-CENTRIC DISAGGREGATION Conductor picks a prefill + decode pair prefill pool reuse cached prefix blocks, compute the rest in chunks, goal: TTFT SLO decoding pool continuous batching, as many tokens per batch as the TBT SLO allows RDMA distributed KVCache pool spare CPU, DRAM and SSD of the GPU servers; hot blocks replicated load / store layer by layer PREFIX BLOCKS ARE HASH-CHAINED (FIGURE 3) A=h(a) B=h(A+b) C=h(B+c) D=h(C+d) E=h(D+e) match ✓ ✓ ✓ then miss: a block is reused only if every earlier token matches Public trace: 23,608 requests over one hour; mean input 8,590 tokens, mean output 182; 512-token blocks. Even with unlimited cache, only 55% of blocks hit (LRU 0.34 at 1k blocks, 0.55 at 50k). MEAN TTFT BY PREFILL SCHEDULER (FIGURE 8) random 92.07 s load-balancing 60.41 s cache-aware 14.36 s KVCache-centric 6.26 s 8 prefill + 8 decode instances, 23,000 replayed requests REQUESTS REJECTED AT 2x LOAD (TABLE 3) reject after prefill 4,183 early rejection 3,771 early rejection + prediction 3,589 bars start at 3,000; prediction rejects 14% fewer REAL TRAFFIC (SECTION 8.1.3) Mooncake 10P+10D vs vLLM 20 instances, same TTFT; TBT under 0.1 s: ~100% vs 57% of requests ≈75% more requests served within the SLOs all results use a dummy LLaMA2-70B-shaped model simulated long prompts: 50% to 525% more throughput
Mooncake splits prefill from decode, pools the KV cache in the cluster's spare CPU memory and SSD, and lets one scheduler place each request by where its cached prefix lives and how loaded each node is.
Research notes: the problem, approach and results
~75%

more requests served within latency targets than vLLM on the same number of instances, replaying real Kimi traffic

92.07 → 6.26 s

mean time to first token, random placement vs KVCache-centric scheduling, 8 prefill and 8 decode instances

55%

share of KV cache blocks that could ever be reused in the public one-hour trace, even with unlimited cache

THE PROBLEM

A long-context chat service spends most of its GPU time on prefill, much of it recomputing prompts it has seen before, and it runs overloaded at peak. Reusing cached KV from another machine costs transfer time, big decode batches raise time between tokens, and accepting a request that later can't be decoded wastes the prefill.

THE IDEA

Disaggregate everything around the KV cache: separate prefill and decode pools, a distributed KV cache pool in each server's spare DRAM and SSD connected by RDMA, a global scheduler (Conductor) that picks the prefill node with the lowest estimated time to first token counting cache hits, queue and transfer, and an admission policy that rejects early based on the decode load predicted for when prefill finishes.

THE RESULT

On a 23,000-request real trace, KVCache-centric scheduling cut mean time to first token from 92 s (random) and 60 s (load-balanced) to 6.3 s. Simulated long-context workloads saw 50% to 525% more throughput than vLLM within SLOs, real traffic about 75% more requests, and predicted early rejection cut rejections 14% under 2x overload.

02

Why it matters to an FDE

Customer deployments of long-context assistants (document Q&A, codebase chat, agents with big system prompts) look like Kimi's traffic: inputs tens of times longer than outputs, and the same prefixes arriving again and again. That is where Mooncake's lessons apply.

Prefix reuse is the cheapest throughput you will find. Every token of a repeated prefix served from cache is prefill you don't compute. The trace shows the ceiling is workload-specific (55% here, up to 90% for their paper-chat service), so measure it on the customer's logs before promising a number.

Routing by load alone throws the cache away. Sending a request to the least-busy node instead of the one holding its prefix gave a mean TTFT ten times worse in the paper's test. A router that knows where prefixes live is worth more than a smarter load metric.

Plan for overload, not just for peak. GPU supply is fixed in most deployments. Deciding which requests to refuse, and refusing them before spending prefill on them, decides how much useful work the cluster does at peak.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 149 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    Design choices, the reuse ceiling, scheduler results and three misreadings

    Free account
  2. 04How it works

    Request flow, the scheduling algorithm, hashing, and admission under overload

    Premium
  3. 05The numbers that matter

    Trace statistics, scheduler TTFTs, end-to-end gains, real traffic and overload

    Premium
  4. 06Try it yourself

    Check the trace math, build hash-chained prefix keys, compare caches and simulate admission

    Premium
  5. 07Where it breaks

    A dummy model, hand-tuned thresholds, simple load prediction, ratios, and slips

    Premium
  6. 08Using it on a deployment

    Measuring reuse, sizing the cache, routing by prefix and admission control under overload

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →