The S3-FIFO cache is a new eviction design built from three plain first-in, first-out queues. In a test on 6,594 traces from 14 datasets, it was compared with 12 state-of-the-art algorithms and had the lowest mean miss ratio on 10 of the 14 datasets. It also avoids taking a lock when an object is hit, which matters on busy multi-threaded servers.
Why most cached objects never come back
Every cache has to decide what to throw away when it fills up. The classic answer is LRU, which keeps recently used objects and drops the one untouched for longest. The S3-FIFO team starts from a different observation: cache workloads are skewed, and a cache only ever sees a short stretch of the request stream.
In that window, most objects are requested exactly once. With a cache sized at 10% of a trace’s footprint, about 72% of objects are not reused before they are evicted. LRU still holds each of these one-hit wonders for a full trip through its queue, and that wastes room that reused objects could have used.
How the three queues work
The name stands for Simple, Scalable and Static FIFO. New objects land in a small queue, called S, which holds about 10% of the cache. Most of them are never asked for again and leave quickly.
An object that is hit twice while in S moves to the main queue, M. Everything else is evicted as soon as S needs room. The designers call this quick demotion.
The third queue, G, is a ghost queue. It stores only the keys of objects pushed out of S, as many keys as M holds objects. If a key is requested again while it sits in G, the object goes straight into M.
M follows its own rule. When it needs space, it looks at its oldest object. If that object’s counter is above zero, it is reinserted with the counter lowered by one, which the authors call lazy promotion. If the counter is zero, the object is evicted.
No lock on the hot path
A hit costs one atomic update to a counter that is capped at 3. Nothing moves in a queue and nothing locks, so the hot path stays cheap. That is why throughput climbs as more threads are added, whereas designs that reorder a list on every hit tend to stall on contention.
The project reports that, for the same 10% miss ratio, S3-FIFO needs up to 46% less cache than the alternatives it tested. Smaller caches for the same hit rate means lower memory bills for anyone running a large fleet.
Trying the S3-FIFO cache yourself
There is a Python package, installed with pip install cachemon. You create a cache with S3FIFO(cache_size=1000), then call put with an optional time-to-live, get, and delete. It also behaves like a dict, so assigning a value to a key works as expected.
For production use, the project points to libraries in several languages. To check the idea against your own workload, you can replay your traces in libCacheSim, a simulator from the same group.
Where it already runs
S3-FIFO and close variants are used in proxies, databases, storage engines and stream processors. One project’s documentation describes its algorithm as a Clock-PRO variant “very similar to” S3-FIFO, and other pull requests and proposals to adopt it are still open.
The research credits a long list of backers and collaborators, among them Carnegie Mellon University, Emory University, Meta, Google Cloud, AWS, Microsoft Azure, VMware and the NSF. Twitter, Meta, Tencent, Microsoft and Wikimedia are listed among its users, along with CloudPhysics.
What to watch next
The adoption list is the thing to follow. The open pull requests could add S3-FIFO to more widely used software, and each one will bring workloads the original traces did not cover. The maintainers say they want to hear how deployments go, so real-world miss ratios may soon be published alongside the benchmarks.
If you run a cache where most keys are read once, a single-pass check with your own traces is cheap. The S3-FIFO cache earns its place only if your traffic looks like the skewed workloads it was measured on.
Source: s3fifo.com