Cache eviction

Hand-drawn two terracotta rails holding a row of hatched tiles across a wall of cream, sand, umber and moss tiles, with three tiles tumbling loose past the rails' right end.

A cache eviction policy is the rule that decides which entry a bounded cache removes when it needs room for a new one. A related admission policy decides whether the new entry deserves the room at all.

Studies on large collections of production traces disagree on which policy misses least. Simple policies built from first-in, first-out (FIFO) queues lead in their authors’ evaluations. Other studies find workloads where older adaptive or learned policies win (Yang et al., 2023c; Zhou et al., 2025a; Yang, 2024). The other disputes concern whether admission filters such as TinyLFU help, and whether a higher hit ratio means a faster cache when many threads share it (Lyons & Rangaswami, 2024; Qiu et al., 2026).

The main measure is the miss ratio: the fraction of requests the cache cannot serve, so lower is better. A miss sends the request to a slower store, such as a database, a disk or an origin server. How the cache keeps its bookkeeping also matters, because that work happens on every hit. The broader question of picking a structure for a task is covered in Choosing algorithms and data structures.

The policy families and their data structures

Each policy keeps some history about its entries, and that history sets its cost on every access. Least-recently-used eviction (LRU) removes the entry unused for the longest time, so it must reorder entries on each hit. Java’s LinkedHashMap in access order does this with a hash table for lookup and a doubly linked list that records the order of last access (Oracle, n.d.c).

Least-frequently-used eviction (LFU) removes the entry with the fewest accesses. One design keeps a linked list of access counts, each holding the entries with that count, which makes every operation take constant time when hashing does (Shah et al., 2010).

CLOCK favours recently used entries without reordering them. It keeps entries in a circular buffer with one use bit each. A moving hand sweeps the buffer looking for an entry whose bit is clear, so a recently used entry gets a second chance (Burnett et al., 2002). PostgreSQL uses this “clock sweep” for its shared buffers (PostgreSQL Global Development Group, n.d.c).

Adaptive policies balance recency against frequency. ARC keeps one list for entries seen once recently and one for entries seen more often, and shifts space between them as the workload changes. It also remembers recently evicted entries, so its directory covers twice as many pages as the cache holds (Megiddo & Modha, 2003). The older 2Q policy uses a similar memory of evicted entries to decide which pages enter its main queue (Johnson & Shasha, 1994).

FIFO-based policies evict in insertion order and avoid reordering on hits. In SIEVE, a hit only sets a “visited” bit and leaves the entry where it is in the queue (Zhang et al., 2024h). S3-FIFO is another policy built from FIFO queues (Yang et al., 2023c). A newer group of learned policies, such as 3L-Cache and Learning Relaxed Belady, uses machine-learned predictions to choose what to evict (Zhou et al., 2025a; Song et al., 2020).

Which policy misses least

Rankings of policies by miss ratio are contested, because they change with the cache size, the workload and the study.

FIFO-based policies lead in the evaluations by their authors. S3-FIFO had the lowest mean miss ratio on 10 of its 14 datasets, and led on seven at the smaller simulated cache size (Yang et al., 2023c). SIEVE’s own web-cache evaluation found that 2Q and another policy, LHD, sometimes missed less than SIEVE when the cache was very small (Zhang et al., 2024h).

Block-storage workloads favour other policies. In a later comparison by a coauthor of both SIEVE and S3-FIFO, SIEVE missed more than both ARC and S3-FIFO on four block-cache workloads, including CloudPhysics and Alibaba traces (Yang, 2024). In a preprint on caches of variably sized objects, FIFO-family policies trailed the leading options on the trace families with large objects (Wang, 2026a).

Learned policies report gains over the heuristics. 3L-Cache achieved the best byte or object miss ratio among the twelve policies its authors compared. It also missed fewer bytes than LRU on traces from CloudPhysics, Tencent, Twitter and Alibaba (Zhou et al., 2025a). On six content-delivery network (CDN) production traces, Learning Relaxed Belady cut wide-area traffic by 4–25% compared with the typical deployment, LRU protected by a Bloom filter (Song et al., 2020). In a later preprint, a FIFO variant called S4-FIFO reported a 26% improvement over S3-FIFO in relative miss-ratio reduction from FIFO at a large cache size. At the smaller size it was slightly worse than 3L-Cache (Xia et al., 2026a).

The best policy can even change within one trace. In a replay of one CloudPhysics trace, LFU had the uniquely lowest miss ratio for 29.6% of the trace’s duration and S3-FIFO for 31.4% (Shakiba & Stumm, 2025).

Admission filters Contested: studies disagree on this

Whether an admission filter improves the hit ratio is disputed: the authors of TinyLFU found gains, and an independent study on storage traces found mostly losses. An admission filter sits in front of the eviction policy. TinyLFU consults recent access history to decide whether a new entry should replace the entry the eviction policy would remove (Einziger et al., 2015).

The authors found that adding TinyLFU helped the eviction policies they tested on a workload built from changing video popularity (Einziger et al., 2015). In their earlier experiments on weekly video popularity, the benefit was larger when popularity changed more slowly (Einziger & Friedman, 2014).

An independent replay of block input/output (I/O) traces found the opposite. Plain TinyLFU generally lowered the hit rate compared with the same replacement policy alone; LRU on one trace, CloudVPS, was the exception (Lyons & Rangaswami, 2024). The filter did produce the fewest cache updates of the methods compared (Lyons & Rangaswami, 2024). The two studies used different workloads, and the independent one tested plain TinyLFU only.

Window TinyLFU (W-TinyLFU) pairs the filter with a recency window, and the best size of that window depends on the workload. A follow-up by the same group found that search-query traces favoured a small window, while a trace from the Gradle build cache favoured a large one (Einziger et al., 2018). The Caffeine library for Java resizes the window to the workload as it runs (Manes, 2021).

Throughput under concurrency

When many threads share a cache, the bookkeeping on hits can limit throughput. Exact LRU moves an entry to the front of a shared list on each hit, and threads contend for that list. A higher hit ratio can therefore lower throughput, because more requests take the contended hit path (Qiu et al., 2026). In the same authors’ queueing model, making the list update faster changed little when that update was not the bottleneck (Qiu et al., 2026).

Lazy promotion trades a few hits for less work on each hit. In one 16-thread benchmark, Delay-LRU, which postpones the move to the front, reached five times the throughput of exact LRU in one setting (Chen et al., 2025c). The cost appears in the miss ratio. Probabilistic-LRU, which moves a hit entry to the front with only 5% probability, missed 6% more than LRU on average across 6,357 traces (Chen et al., 2025c).

Splitting the cache into small groups also reduces contention. In a set-associative cache, each entry may live only in one small set of slots rather than anywhere in the cache. Allowing eight entries per set often gave a hit ratio close to a cache where entries could go anywhere, though one trace still showed a gap (Adas et al., 2021). These caches reached up to five times the throughput of production caching libraries (Adas et al., 2021).

The set size has a limit in theory. Take LRU with entries assigned to sets at random. If the set size grows more slowly than the logarithm of the total capacity, some request sequences miss far more than in a much smaller cache with no sets (Bender et al., 2023). Memcached also splits its LRU: its default LRU since version 1.5.0 is split into four subqueues, each with its own lock (Dormando, 2018).

Object sizes, miss costs and expiration

When entries differ in size or in the cost of a miss, the cache must choose what to minimise, and the choice changes the best policy. Counting missed requests and counting missed bytes can lead to different eviction decisions on CDN workloads, where objects vary in size (Wang et al., 2024b). Requests and bytes trade off in measurements. In one comparison against an unmodified Varnish web cache, size-aware admission at the memory tier left the disk tier serving 60% fewer requests but transferring 30% more bytes (Berger et al., 2017).

Unequal costs of rebuilding an entry change the choice too. A cost-aware policy, GD-Wheel, cut the total cost of recomputing missed entries by up to 90% compared with LRU in a Memcached evaluation with a standard cloud-serving benchmark (Li & Cox, 2015).

Expiration shrinks the memory a cache needs. Many caches give entries a time to live (TTL), after which they expire. In a study of Twitter’s cache clusters, TTLs limited the working set of unexpired entries (Yang et al., 2020a). A sizing study found that the miss ratio of one Twitter workload stopped improving at 7.3 GB when expiration was modelled, against 123 GB when it was ignored (Sultan et al., 2024). Across its workloads, sizing with expiration taken into account used 66% less memory on average (Sultan et al., 2024).

Sizing and evaluating a cache

A miss-ratio curve helps choose a cache size. It plots how the fraction of misses falls as capacity grows, for one eviction policy, which shows the trade-off between memory cost and misses (Shakiba et al., 2024). Simulators replay recorded requests to draw these curves. The Python interface of libCacheSim, for example, reports both the request and the byte miss ratio for a configuration (libCacheSim Python, n.d.).

Implementation details change results even under one policy name. In experiments on Memcached, three LRU variants (sampled, lazy and segmented) generally had similar miss curves. Segmented LRU, however, missed much more on one trace at some cache sizes (Yang et al., 2023a).

Policies in common software

Widely used caches ship a range of policies, and their defaults change between releases. The table lists what each system documents.

SystemDocumented policy
Caffeine (Java library)Window TinyLFU, with the window sized to the workload (Manes, 2021)
RedisApproximate LRU and LFU, choosing eviction candidates from a random sample of keys (Redis, 2024)
MemcachedSince 1.5.0, a modified LRU split into four independently locked subqueues (Dormando, 2018)
Apache Traffic Server (RAM cache)LRU by default; CLFUS and S3-FIFO as alternatives (Apache Traffic Server, n.d.a)
PostgreSQL 18 (shared buffers)Clock sweep, with a small reused ring of buffers for large sequential scans (PostgreSQL Global Development Group, n.d.c)
Java standard libraryLinkedHashMap in access order gives exact LRU ordering (Oracle, n.d.c)

A policy name in documentation can hide differences between releases. Apache Traffic Server’s 10.1.x reference lists only LRU, the default, and CLFUS (Apache Traffic Server, n.d.b). The 10.2.x reference adds S3-FIFO as experimental, without the “seen” filter or in-memory compression (Apache Traffic Server, n.d.c).

Further reading

  • Yang, Zhang and colleagues, “FIFO queues are all you need for cache eviction” (2023): the S3-FIFO paper and its comparison across 14 trace collections (Yang et al., 2023c).
  • Zhang and colleagues, “SIEVE is simpler than LRU” (2024): a one-bit FIFO-based policy, with the small-cache cases where it loses (Zhang et al., 2024h).
  • Lyons and Rangaswami, “To cache or not to cache” (2024): the independent block I/O replay in which plain TinyLFU mostly lowered hit rates (Lyons & Rangaswami, 2024).
  • Qiu, Yang and Harchol-Balter, “Why increasing the hit ratio can hurt cache throughput” (2026): a queueing model of contention on the hit path (Qiu et al., 2026).
  • Sultan and colleagues, “TTLs matter” (2024): how expiration changes miss-ratio curves and cache sizing (Sultan et al., 2024).
  • Manes, Caffeine design notes (2021): how a widely used library implements Window TinyLFU (Manes, 2021).

Known gaps

What this article cannot tell you yet.

  1. The size of TinyLFU’s hit-ratio gains over other policies is not given; only the direction of the result is.
  2. Whether Window TinyLFU, with its recency window, recovers the hits that plain TinyLFU lost on block I/O traces is not covered by an independent test here.
  3. Most miss-ratio comparisons come from the authors of one of the compared policies; replications on fresh collections of production traces are missing.
  4. How hit-path costs and real backend service times combine in end-to-end measurements is covered only by one queueing model.
  5. Hardware CPU cache replacement and HTTP caching headers are outside this article.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 36 references