Admission Policies and W-TinyLFU: Filtering Cache Pollution
The Cache Pollution Problem
Standard eviction policies assume any fetched item is worth caching. This fails under two workloads. One hit wonders: items accessed exactly once (batch jobs, cold starts). Scan traffic: sequential access touching millions of keys once. Both evict hot data in favor of items never accessed again, collapsing hit rates from 80% to under 20%.
How Admission Works
An admission policy gates cache entry. When a candidate arrives, it competes against the eviction victim. If the candidate has higher historical frequency, it wins admission and the victim is evicted. If lower, the candidate is rejected. One hit wonders lose because they have zero prior accesses.
W-TinyLFU Architecture
W-TinyLFU combines three components. A Count Min Sketch (CMS) tracks frequencies using multiple hash functions mapping keys to counter arrays. Query all positions, take the minimum. Width 10,000 and depth 4 uses 40 KB with under 2% error. A window segment (1-2% capacity) absorbs bursts via LRU. Main cache splits into probation (20%) and protected (80%).
Sketch Aging
Counter aging halves all values every N accesses (typically 10x cache size). This bounds stale history so decisions reflect recent patterns.
10-30% over LRU. At 100,000 QPS, reducing miss rate from 20% to 14% saves 6,000 backend requests per second.