Skip to content
About
Main content

The eviction policies compared

Which policy fits which position in a hierarchy, and why does randomized eviction have the best worst case?

The policies, compared properly

PolicySignalPer-entry stateWrite on the read path?PathologyBest position in a hierarchy
FIFOinsertion ordernonenoignores locality entirelybottom tiers and very large , where metadata and contention dominate
recencylist pointersyesa cyclic scan just larger than C gives 0% hitstop tier only
LFU (without aging)frequencycounteryespollution by dead popularitynowhere, unless aged
LRU-K / 2Q / ARCrecency + frequencymoreyesmany parameters to tunebuilt for filtered streams, such as buffer pools
aged + small window~10 bits, amortizedno (batched)needs a workload with structuregeneral default
Cost-aware ()f · c / scounter + costyesfeedback oscillationmixed cost classes
Random / markingnonenone (marking: one bit)noexploits no localitybest provable worst case; no contention

(A filtered stream is one where an earlier cache has already taken the easy repeats away, as What makes data cacheable explained.)

Two rows deserve attention.

FIFO's return is real current engineering practice, not nostalgia. Recent research shows that FIFO variants can match the of the LRU family at very large scale, with much less metadata and no lock on the read path. The reason comes from What makes data cacheable: at the bottom of a hierarchy, the stream has already lost its recency (the upper tiers absorbed the repeats), so LRU's signal is worth little, while its contention cost is not.

Randomized eviction (the marking algorithm) has a provably better worst case, at one bit per entry and zero contention. That is a strange fact: the simplest policy is the best behaved in theory. It loses in practice only because real streams have the locality that the adversarial bound ignores. (The Θ(log k) guarantee is proved for the marking algorithm, which evicts a random unmarked entry. Plain random eviction is k-competitive, the same as LRU.)

Compression: Position and cost variance choose the policy. A read that changes state is the hidden cost. The best-behaved policy in theory needs only one bit per entry.