arXiv:2610.38355cs.DCOct 2026

Manuscript Offprint

arXiv:2610.38355

FlatCake: A Flat KVCache Storage Architecture for LLM Serving

Xin Huang, Teng Ma, Zhuoran Li, Yibo Zhao, Zhaoshi Li, Qianchao Zhu, Wei Yang, Chenxi Wang, Tao Xie, Youwei Zhuo

Abstract

KV cache reuse accelerates LLM serving, but existing systems manage host DRAM and NVMe SSD as a tiered hierarchy where DRAM acts as an intermediate cache. Production LLM workloads break both premises of this hierarchy. First, bimodal reuse defeats DRAM temporal filtering, since workloads are dominated either by one-shot blocks with long reuse distances or by multi-gigabyte agentic sessions that exceed DRAM capacity, putting SSD on the critical read path. Second, DRAM staging and eviction-ordered layout bottleneck SSD restoration. Holding host staging buffers for in-flight prefixes causes contention under load that aborts prefetches, while incremental eviction scatters a session's blocks across the SSD and prevents large sequential reads.

We present FlatCake, a flat KV storage architecture that exposes host DRAM and NVMe SSD as peer media in a unified 64-bit address space. Exploiting the fact that KV blocks are write-once, immutable, and reused at session scope, FlatCake places each block directly onto its target medium in session-contiguous, layer-major order at creation time and never migrates it. FlatCake streams coalesced SSD reads directly into a bounded GPU window via GPUDirect Storage and decouples DRAM and SSD request queues to prevent head-of-line blocking. On a production Claude Code trace with DeepSeek-V4-Flash, FlatCake sustains a 94% cache hit rate as load increases (versus 64% for Mooncake), eliminates Mooncake's 6.5×–6.7× SSD read amplification, and reduces peak-load mean TTFT by 1.6× while improving total token throughput by 1.6×. Across 8K–128K contexts on Llama-3.1-70B, FlatCake further reduces mean TTFT by up to 2.4× over Mooncake and 1.8× over Mooncake-GDS.

Keywords: LLM serving, KV cache management, memory tiering, flat KV storage, GPUDirect Storage

1 Introduction

Prefix caching is now standard in large language model (LLM) serving, allowing requests that share a prefix to reuse previously computed key-value (KV) tensors and avoid redundant prefill computation [16, 27, 47]. As LLM workloads evolve

Figure

Figure 1. Tiered and flat KV cache storage. (a) Tiering ranks DRAM above SSD, so a block reaches SSD only when LRU evicts it. (b) FlatCake places both media at one level behind a unified address space and writes each block straight to its target, so nothing migrates.

from short, globally shared system prompts [38] to multi-turn conversations [12] and long-context agentic coding sessions that append tool outputs and retrieved files on every turn (averaging 219K input tokens per request in a production Claude Code trace [33]), active KV working sets routinely reach tens of gigabytes per session and span hours. Because these working sets far exceed GPU HBM and host DRAM capacity, while recomputing evicted history consumes up to 93% of prefill compute [12], NVMe SSDs must serve as a primary KV cache medium on the critical path [28].

Existing systems such as Mooncake [27], LMCache [7], and SGLang HiCache [42] manage GPU HBM, host DRAM, and NVMe SSD as a classical tiered hierarchy (Figure 1(a)), placing host DRAM in front of SSD as an intermediate L2 cache and staging layer. Borrowed from general-purpose memory and storage systems, this hierarchical design relies on two foundational premises: (1) temporal filtering, namely that recency-based caching in DRAM can capture the active working set so the slower SSD serves only cold misses off the critical path; and (2) staging and coalescing, namely that because incremental eviction scrambles on-disk layout relative to read order, staging SSD accesses through host DRAM buffers is an effective way to reassemble scattered

Xin Huang, Teng Ma, Zhuoran Li, Yibo Zhao, Zhaoshi Li, Qianchao Zhu, Wei Yang, Chenxi Wang, Tao Xie, and Youwei Zhuo

reads and hide device latency. Profiling eight production traces from Mooncake, Qwen Bailian, and Claude Code (§2.2) reveals that LLM KV cache workloads violate both premises simultaneously.

First, bimodal reuse defeats DRAM temporal filtering, putting SSD on the critical read path. Across production traces, KV reuse falls into two regimes, and neither fits a DRAM cache filter. In conversational and API workloads (seven traces), 53–94% of KV blocks are accessed only once, while reusable prefixes span long reuse distances of hundreds to thousands of intervening requests; admitting every request into DRAM pollutes it with one-shot blocks that flush reusable prefixes to SSD before their next turn arrives. Conversely, in agentic coding (Claude Code), 83.4% of blocks are reused (98.3% ideal hit rate) with immediate turn-to-turn locality, but multi-gigabyte session footprints quickly exceed host DRAM capacity across concurrent sessions. In both regimes, most cache hits must be served from NVMe SSD, so migrating blocks between DRAM and SSD adds data movement without keeping hot data in DRAM.

Second, DRAM staging and eviction-ordered layout turn SSD restoration into a concurrency and I/O bottleneck. When SSD must serve the bulk of hits, the tiered mechanisms meant to smooth SSD access become the bottleneck itself. Restoring a long-context prefix through host DRAM requires holding host staging buffers for the entire in-flight hit, scaling memory demand with context length and concurrency. Even when SSD-to-DRAM and DRAM-to-GPU transfers are pipelined, concurrent restores contend for bounded staging memory, delaying or aborting prefetches under load and turning blocks already stored on SSD into recomputed misses. Worse, even when bypassing host DRAM via batched GPUDirect Storage (GDS), tiered storage populates and reclaims SSD space in eviction or FIFO-bucket order rather than session order. As a result, a session's blocks are scattered across non-contiguous SSD offsets and coarse bucket reclamation invalidates active prefixes across sessions, forcing O(layers×blocks)O(\text{layers} \times \text{blocks}) fragmented reads that underutilize sequential NVMe bandwidth.

Why does tiered storage fall into this trap? Tiering is designed for mutable pages whose future access patterns and spatial grouping are unknown when written. Our key insight is that LLM KV cache blocks are write-once, immutable, and reused together at the granularity of a session scope. Because a block is never modified in place, there is no dirty state to write back; because blocks generated in a turn belong to a known session prefix and are always restored together across layers on subsequent turns, their ideal on-disk spatial grouping is already known at creation time. Consequently, if blocks are placed directly onto their target medium in session-contiguous, layer-major order at write time and never migrated, SSD restores become naturally sequential and no longer need host DRAM for either caching or reassembly.

Based on this insight, we propose FlatCake, a flat KV storage architecture that replaces the migratory hierarchy with peer storage media (§3). As shown in Figure 1(b), FlatCake exposes host DRAM and NVMe SSD at the same level behind a unified 64-bit Global Virtual Address (GVA) space, placing each KV block once at write time without cross-tier migration. FlatCake realizes this architecture through three coordinated components:

  • FC-GVA: Global Virtual Address Manager (§3.2). FC-GVA decouples KV placement from eviction by binding each block to DRAM or SSD once at creation within a session-contiguous scope and encoding its medium, node, and offset in an immutable 64-bit GVA. This eliminates cross-tier migration, enables O(1)O(1) media-aware routing without tier-by-tier lookup, and supports zero-writeback, session-granularity SSD reclamation.
  • FC-MAS: Medium-Aware Request Scheduler (§3.3). Using the media semantics embedded in each GVA, FC-MAS isolates fast DRAM-ready requests from long-latency SSD-preparing requests without DRAM pre-staging, schedules background SSD prefetches by size-aware response ratio, and re-admits prefetched requests by original arrival time to prevent both head-of-line blocking and starvation.
  • FC-CIO: Coalescing Direct I/O Engine (§3.4). FC-CIO co-designs write-time layer-major scope layout with read-time request coalescing to collapse O(layers×blocks)O(\text{layers} \times \text{blocks}) scattered page reads into O(layers)O(\text{layers}) sequential GPUDirect Storage transfers, streaming them through a bounded GPU HBM window overlapped with layer-wise computation to eliminate host staging contention.

We implement FlatCake in SGLang and evaluate it with DeepSeek-V4-Flash (284B hybrid MoE) on NVIDIA B200 GPUs and Llama-3.1-70B (dense GQA) on NVIDIA A100 GPUs (§5). Replaying a production Claude Code trace across increasing arrival rates, FlatCake sustains a 94.2–94.6% delivered cache hit rate, staying within 0.6 percentage points of the trace's 94.7% prefix-reuse ceiling, whereas Mooncake's hit rate drops from 87.9% at low load to 64.3% under staging contention. At peak load, FlatCake reduces mean and median TTFT by 1.6× and 1.8×, improves total token throughput by 1.6×, achieves 1.9× higher SSD read bandwidth with 5.8× lower prefetch latency, and eliminates Mooncake's 6.5×–6.7× SSD read amplification. Across 8K–128K contexts on Llama-3.1-70B, FlatCake further reduces mean TTFT by 2.3×–4.9× over prefix recomputation, 1.5×–2.4× over Mooncake, and up to 1.8× over Mooncake-GDS.

Table 1. KV cache reuse statistics across eight production LLM traces under an infinite-capacity cache.

WorkloadRequestsUniqueOnce-Reuse distHit
blocksaccessMeanP99rate
Mooncake Traces [27]
Conversation12,031182,79075.8%7285,52736.64%
Synthetic3,99343,92458.4%4302,23563.96%
ToolAgent23,608183,30078.5%4894,08555.26%
Qwen Bailian Traces [38]
to-C43,0582,530,33753.2%1,45013,97359.4%
to-B API172,8003,830,39094.0%2,55054,72861.3%
Thinking10,8121,735,01585.7%1552,35746.2%
Coder43,0115,202,51761.0%1,09516,22466.4%
Agentic Trace [33]
Claude Code98,8275,717,18516.6%0.851498.31%

References (10)