Inference systems · Research feature

Gandalf System Extends SSD Lifespan in LLM Serving Without Reducing Cache Efficiency

A new system reduces write operations to SSDs in large language model serving by prioritizing certain types of KV cache data, extending storage life without harming performance.

Adapted from research by Maharani A. P. Irawan, Kuntai Du, Jiayi Yao and colleagues.

arXiv preprint revision · 2026-10-22 · Attribution & reuse
In this article
Editorial illustration of optical fibers.

Editor’s introduction

The study focuses on improving the lifespan of SSDs used to offload KV cache data in large language model (LLM) serving systems. Researchers compared the impact of different KV cache write strategies, measuring how well each approach preserved SSD lifetime while maintaining cache hit rates. The study evaluates how attention type—such as full-attention versus other types—affects historical and future access patterns. By prioritizing full-attention KV cache writes into SSDs, the system reduces unnecessary writes that degrade storage life. The findings show minimal impact on cache hit rates, indicating that performance is preserved.

Introduction

Large language models (LLMs) have demonstrated strong capabilities in multi-round conversations and agentic workflows, garnering wide adoption. These workloads accumulate conversation histories, tool outputs, and intermediate states, resulting in increasingly long and frequently reused contexts. However, recomputing the attention key-value (KV) states for these contexts at every rounds substantially increases inference latency and cost. Hence, people store all KV caches in their system to avoid recomputation and increase cache hit rate. Production workloads generates Terabytes of KV-cache per day at the amount that exceeds the capacity of GPU and host memory, motivating the use of higher-capacity storage tiers. Flash-based storage, e.g. NVMe SSDs, provides a scalable and comparatively cost-effective tier for storing these caches.

The key challenge lies in predicting the future reuse of KV caches such that we can selectively retain only the most reusable caches to make the most of SSD’s capacity. Future prediction is difficult, but we found application-specific property that strongly correlates with reuse pattern. We leverage two observations: (1) Recent LLMs increasingly employ hybrid architectures that combine full-attention layers with linear- or sparse-attention layers, and (2) These different attention layer types produce KV caches with substantially different reuse patterns under emerging mainstream workloads: multi-round conversations and agentic workflows. In particular, states from linear- and sparse-attention layers are reused less frequently than KV caches from full-attention layers.

This reuse pattern heterogeneity motivates attention-type-aware cache placement. Writing large, one-time use linear-attention states to SSD provides little cache hit benefit while consuming both write endurance and cache capacity. Layer type can therefore serve as a practical placement signal, allowing us to utilize SSDs to expand cache capacity while minimizing endurance loss. We propose an attention layer-aware placement policy that caches short-lived linear-attention states in host memory while keeping longer-lived full-attention KV caches on SSD.

First, this placement policy is too rigid: the size of CPU DRAM and SSD is fixed, but workload can generate different amounts of different attention states. Particularly, a workload with many concurrent sessions can generate a large number of reusable linear-attention states that exceeds the available DRAM capacity, similarly, a workload with long contexts can generate a large number of reusable full-attention KV caches that exceeds the available SSD capacity. We call this a hardware-to-utilization imbalance. This imbalance forces frequent cache eviction on the saturated tier despite available capacity elsewhere in the storage hierarchy, thus lowering cache-hit rate. Worse, if the overutilization happens in SSD, the resulting write churn can consume its endurance budget more rapidly and further shorten its lifetime. Therefore, we design a capacity-aware placement policy that filters SSD admission based on utilization and pressure of each tier, balancing cache hit rate against SSD endurance.

KV Caches Exceed Memory Capacity

Over the past years, the increasing intelligence and context window size of LLMs empowered multi-round conversations and agentic workflows. These types of workloads continuously accumulate conversation history, intermediate reasoning, tool outputs, and subagent results. Unlike single-turn requests, these workloads repeatedly extend and reuse an existing prefix, causing each session’s KV-cache footprint to grow throughout its lifetime. Hence, the aggregate KV cache sizes saved across requests and sessions are getting enormous.

Long contexts also make cache misses increasingly expensive. When a reusable prefix is not cached, the serving system must recompute its KV states by prefilling all preceding tokens before generating a response. In workloads with long context sizes, such as multi-round conversation, agentic workflow, and long document processing, this repeatedly consumes scarce GPU computation, increasing TTFT and serving cost. People therefore seek to retain as much reusable KV state as possible, effectively trading storage capacity for computation.

Why not HDD cluster?

Local NVMe SSD is a popular extension of the memory hierarchy for LLM serving. Since SSD is known to have a limited endurance problem, why haven’t people used HDD instead? To make HDD fast enough, we could parallelize I/O across a cluster of HDDs. To answer this question, we first compare the endurance of SSD and HDD given the manufacturer’s specifications.

KV Caching is Rapidly Killing SSDs

Under frontier model and agentic workloads, our analysis shows that even a 30-TB enterprise SSD can exhaust its rated TBW in less than one year. Smaller enterprise SSDs wear out even faster, with a 2-TB drive reaching its rated TBW in just days. In §2.2, we discussed that SSD wear is a product of host-write volume and device-level write amplification. We target host writes by reducing the KV-cache writes issued to SSD.

Write-through immediately copies every admitted KV states to SSD, maximizing availability at multiple tiers, but generating substantial SSD write. This duplication preserves the entry after DRAM eviction, but wastes SSD endurance when all of its reuse occurs in a short time while it remains in DRAM. The SSD copy then consumes write budget without serving a cache hit.

Selective write-through reduces this traffic using a fixed reuse threshold; for example, NVIDIA Dynamo offloads a block only after its access frequency reaches two. However, frequency-only filtering ignores state size, layer-specific reuse, tier occupancy, and the remaining write budget, allowing large, short-lived states to consume substantial endurance for little benefit.

How does prior work address SSD endurance?

SSD endurance has long been a concern in flash-based caching systems. Traditional systems, such as Flashcache and Google’s Colossus Flash Cache, use SSDs to accelerate access to persistent data. Recent studies show that KV-cache offloading introduces similar endurance challenges in LLM serving. Existing approaches can be grouped into three categories.

Increasing physical write endurance. Hardware provisioning distributes writes across more SSDs, aggregating write budget and reducing the per-device write rate, thereby increasing aggregate write endurance at the cost of additional acquisition, power, and maintenance costs. Classic SSD endurance technique called retention relaxation increases tolerable NAND program/erase cycles by reducing data retention requirements. FlashAccel exploits the short lifetime of KV caches to trade retention for endurance. However, both approaches increase the available write budget rather than reducing host-level KV-cache writes, and may require additional hardware or device support. They also do not leverage unique property of KV caches: we can choose to not cache the KV cache and recompute it when needed. It may therefore remain insufficient for sustained LLM serving, especially in multi-round and agentic workloads.

SSD lifetime and Cache Hit Rate Trade-off

Storing more KV-cache entries on SSD increases the probability that future requests find reusable state, thereby improving the cache-hit rate and reducing TTFT. However, the resulting write volume rapidly consumes the SSD’s finite endurance budget. Conversely, storing fewer entries reduces SSD traffic and extends device lifetime, but may discard reusable state, lowering the cache-hit rate and increasing TTFT. Thus, when cache entries are homogeneous, improving one objective necessarily comes at the expense of the other. Breaking this trade-off requires identifying writes that consume SSD endurance but contribute little to future cache reuse.

Key Observation: Hybrid model has heterogeneous reuse pattern

Dense models use full attention across all layers. When a cached context is resumed, the KV entries of every tokens in the sequence prefix are reused. Thus, storing a larger portion of the prefix allows more recomputation to be avoided, creating a near one-for-one trade-off between SSD writes and cache-hit rate. Each layer and token’s admitted KV entry provides comparable reuse value, and reducing SSD writes generally sacrifices a corresponding caching opportunity. This creates the apparent one-for-one trade-off between SSD lifetime and cache-hit rate.

Uniformly writing these short-lived states to SSD is inefficient. Write-through immediately persists them, while write-back may persist them upon eviction, even though they are likely to be superseded after only one reuse. When the latest linear-attention state can remain in DRAM until the next round, its SSD copy provides no additional cache hit but still consumes SSD endurance and capacity. Such writes may also evict more reusable full-attention KV entries, further reducing cache effectiveness.

Attention type-aware placement

This heterogeneity in size and reuse pattern brings 2 opportunities: (1) not all KV state needs to be cached, and (2) where an admitted state should be placed. The heterogeneity creates two distinct cache-management decisions. First, admission determines which generated states provide sufficient reuse value to retain. Second, placement determines the storage tier in which each admitted state should reside.

Prior works has solved “which KV state should be cached” by probing the reuse boundary. These mechanisms address which states should be retained, but they do not determine whether an admitted state should reside in DRAM or in SSD. Our work is aimed to improve SSD lifetime by managing KV cache placement leveraging its attention layer type to give a hint on the most suitable placement in the storage tier.

We therefore retain linear state in DRAM and full attention KV caches in SSD. Each linear state generated at the end of each conversation round is put in DRAM while the full attention KV cache is put on SSD. When the storage tier (DRAM/SSD) is out of space, the least-recently-used cache on the tier is evicted.

Capacity-aware KV Cache Management

Gandalf keeps the oracle’s objective (4): maximize the recomputation saved by cache hits while minimizing the cost of SSD writes and replacement cost of evicted objects. With the CPU/SSD ratio insight in §3.2, we design a practical policy that approximates the oracle’s decisions while considering the occupancy of each tier in an online manner.

Optimization

First, only leaves can be dropped, and only root-side DRAM nodes can be moved to SSD. Gandalf only maintains these two sets in an incremental manner. Dropping a leaf exposes at most its parent as a new leaf, while moving a root-side node exposes its children as new move candidates. Thus, recomputing the scores of the caches only happens when there is cache pressure, to a small number of items.

Third, Gandalf partitions root-side DRAM candidates by cache type: linear and full. Within each size class, the candidate with the longest estimated remaining life has the lowest SSD write fee. A lazy heap ordered by remaining life therefore identifies this candidate without rescoring the class again during the request. By default, Gandalf compares only the longest-lived candidate from each size class. In later evaluation, we show that comparing only one candidate does not sacrifice performance. A separate lazy min-heap over SSD leaves identifies the lowest-valued SSD victim, and hence the replacement cost when DRAM pressure triggers a move from DRAM to SSD such that an object needs to be evicted from SSD to make room. After the heaps are built, each decision examines only their heads, rather than rescoring or sorting all cache objects.

Implementation

Verifying the simulator. We first ran vLLM and connect it with LMCache on RawBlock mode, with a Claude Code trace, then attaching an eBPF-based logger to dump out the storage-facing trace. This includes columns such as: timestamp since first run, type of operation (R/W), logical block address (LBA) accessed, size, and number of pages. We then replayed this trace on FEMU with a 1TB @ 0.3 DWPD for 5 years SSD configuration to observe SSD lifetime given a KV cache offloading workload, resulting to our finding that KV cache is killing SSD. From this result, we obtained the SSD lifetime duration. Then, we build a trace-based simulator that estimates SSD lifetime by the TBW, and confirm the lifetime using the SSD lifetime we obtained by using SSD emulator. Simulator are needed to test all of our experiments prior to implementing in real hardware, which will effectively kills SSD for sure. After all technique was confirmed, we move our technique to real production system, involving LMCache deployed as a backend for vLLM inference engine.

SSD lifetime estimation. Specifically, given that we confirmed the SSD lifetime using an emulator in the small scale, we estimate SSD lifetime by the TBW (Total Bytes Written). Once one trace is replayed, we can obtain the total write volume to SSD. Assuming that this trace is replayed over and over in production system, we can then obtain the total write volume per day, and then estimate the SSD lifetime by dividing the TBW by the total write volume per day.

Hardware specs. The simulator models the hardware specs of the system that affects the transfer between SSD, CPU DRAM, and GPU HBM. We assume a specific GPU model, check the tokens per second throughput, and every generated KV cache is directly saved in the KV cache storage, e.g. LMCache. For the SSD model, the simulator supports specifying DWPD (Drive Writes Per Day) and capacity. However, for our evaluation, we assume 1 DWPD (Drive Writes Per Day) for 5 years, which is a majority specification for enterprise SSDs. We check the SSD read and transfer bandwidth via FIO. We then vary the SSD capacity for the evaluation.

Known limitation. The simulator assumes write-amplification factor (WAF) to be 1, since the simulator does not model the SSD internal operations, such as garbage collection, wear leveling, and other internal operations that may affect the SSD lifetime. Hence, the simulator may overestimate the SSD lifetime for all the evaluated techniques, Gandalf and baselines. However, since WAF is implicated by the fast write rate, if we reduce the write volume using Gandalf, we can still reduce the WAF and improve the SSD lifetime.

Setup

Since not all baselines are designed to operate with DRAM and SSD, for evaluation fairness, we augment each baseline with both tiers as a capacity expansion to GPU HBM, thereby increasing their effective cache capacity while preserving their original admission and victim selection rules. A KV cache entry is admitted to lower tiers only if it is evicted from the upper tier. Eviction happens as a side effect of admission, and the eviction policy of each baseline is retained as is. For all baselines that has hyperparameters, we sweep the hyperparameter space to show the best configuration on each trace.

Model Linear-to-Full Sensitivity

The larger the ratio, the higher the penalty of writing a linear state that is never reused, so the improvement obtained by Gandalf ’s filtering is larger. This makes Gandalf especially needed for deployment of hybrid models with large linear-attention states, which are increasingly common in modern LLMs.

Where does the improvement come from?

In summary, the improvement of Gandalf comes from leveraging attention type as a proxy for reusability, which: (1) avoids writing linear states at the end of each rounds to the SSD, (2) avoids writing rarely reused full-attention KV to the SSD, and (3) places linear states in DRAM and full-attention KV in the SSD.

Comparing Gandalf to each baseline

MeritKV. MeritKV admits an object to the SSD only when the prefill it saves outweighs the expected reuse latency plus the write cost, but it admits the first three demands of every object unconditionally to learn its reuse. Most linear states are written before this estimate applies: 97% of the linear states it writes had never been hit before the write. It still writes 36.1TB (4.0 days), only 5.6% of its linear-state writes are hit on the SSD, and it misses 0.807 of chunks.

Tiered KV-cache systems. CachedAttention, FlashGen, LMCache, and Mooncake extend GPU memory with host DRAM, SSD, or distributed storage, while TENURE and placement studies decide where KV caches should reside across these tiers. InfiniGen and Tutti instead reduce lower-tier access overhead through selective fetching and GPU-directed SSD I/O. These systems primarily optimize capacity, latency, or throughput rather than SSD endurance.

KV admission, eviction, and compression. Prior policies predict reuse from prefix structure, recency, frequency, semantics, queued demand, or workload history. MeritKV, Bidaw, LRU-K, and NVIDIA KVBM further incorporate reuse utility, storage cost, or write awareness. Orthogonal techniques reduce the footprint through token eviction, quantization, or model-level KV compression. Most of these techniques do not jointly manage DRAM placement, SSD admission, and SSD eviction using attention-type reuse heterogeneity and an explicit endurance cost.

Flash-aware caching and storage. General flash caches control wear through admission filtering and write-rate constraints, while offline work extends Bélady-style analysis to account for flash erasures. Device- and interface-level techniques reduce physical writes through retention management, stream placement, and cache-aware reclamation. For LLM serving, HiFC, FlashAccel, and HBFlex optimize flash data paths, writeback, and reclamation. These mechanisms are complementary to Gandalf because they do not use attention semantics to value individual KV states.

Lifetime-aware KV placement. Most closely related, Lachesis places agent KV segments across HBM and high-bandwidth flash using lifetimes inferred from the agent harness. In contrast, Gandalf targets host DRAM and SSD, derives reuse differences from hybrid-attention semantics without harness-specific information, and jointly considers capacity, recomputation benefit, and SSD write cost.