The lab below runs all four policies on the same request stream. The chart shows hit rate over the last 400 requests. The keyspace strip shows which keys each cache holds and where the current hot set is. At request 6000 the popular keys are replaced by keys that were cold.
Predict before you press play
hit rate = hits / requests= 151 / 400 = 37.8%hot keys have not moved yet
Replaces the popular keys with keys that were cold.
Hit rate over the last 400 requests
FIFO
LRU
LFU
TinyLFU + SLRU
Hit rate over the last 400 requests (hit rate against requests)
Series
Latest
Lowest
Highest
FIFO
38%
36%
39%
LRU
42%
36%
43%
LFU
45%
36%
45%
TinyLFU + SLRU
47%
36%
47%
Keyspace, 0 to 999
The shaded band is the current hot set. Tall orange marks are cached hot keys. Short grey marks are cached keys that went cold.
FIFO37.8% recent · 34.0% of cache is hot
LRU41.5% recent · 34.0% of cache is hot
LFU44.8% recent · 54.0% of cache is hot
TinyLFU + SLRU46.8% recent · 64.0% of cache is hot