Cache pollution
Cache pollution occurs when cached data displaces other data whose retention would provide greater benefit to the workload.
A scan can cause misses after the scan itself has finished. [1]
Reuse count alone does not define benefit. Prefetched data can be useful on its first demand access. Eviction before that use is prefetch wastage. [3]
A scan is any sequence of one-time requests, and under LRU it can displace pages with lasting value. [1] Two quick successive hits, called correlated references, do not prove long-term utility, so promoting a page after two hits can still pollute the cache, and frequency-based policies can be polluted by stale pages with high counts unless the counts are periodically rescaled. [1] [4]
Sequential scans are a common cause of noticeably worse interactive response times. [6] In a Zipf workload where one third of the references came from scans that never repeat a page, a two-queue policy kept about 70% of its no-scan hit rate and LRU about 60% of its own. [5] A page cache can admit new pages to an inactive list and promote only pages accessed again there, so one-time pages pass through without reaching the protected list. [7]
Relations
- related
- Least recently used replacement, SSD mapping cache, Adaptive Replacement Cache, Cache admission, SIEVE cache eviction, CLOCK cache replacement, Prefetch wastage, Prefetch trigger distance, Ghost cache entry, Page cache, Working set, Locality of reference, 2Q replacement, DULO
Limitations
- In 2Q, protection depends on admission history and workload as well as resident capacity; history-size tuning can help some traces and hurt others. [5, 8]
Citations
- Sorav Bansal and Dharmendra S. Modha. CAR: Clock with Adaptive Replacement. FAST 2004; sections III-V.
- Binny S. Gill and Luis Angel D. Bathen. AMP: Adaptive Multi-stream Prefetching in a Shared Cache. FAST 2007, pp. 185-198; sections II-VI.
- Megiddo and Modha. ARC: A Self-Tuning, Low Overhead Replacement Cache. USENIX FAST 2003, pp. 115-130.
- Johnson and Shasha. 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994, pp. 439-450.
- Jiang and Zhang. LIRS: An Efficient Low Inter-reference Recency Set Replacement Policy to Improve Buffer Cache Performance. SIGMETRICS 2002.
- Linux v6.12 mm/workingset.c, leading comment on double CLOCK lists and shadow entries.
- Waldspurger, Saemundsson, Ahmad and Park. Cache Modeling and Optimization using Miniature Simulations. USENIX ATC 2017, sections 2 and 4.2.
Further reading
Sources & caveats
- The CAR and ARC papers have an author at an industrial research laboratory, the 2Q paper has one author also listed at a software company, and the LIRS paper is university work read from the author-hosted technical report TR-02-6.
- The 70% and 60% figures come from the 2Q paper simulated Zipf workload, not from a production trace.
- A constructed exact-LRU simulation (100-entry cache, 75-entry hot set, Python, fixed seeds) lost 25 hot entries to a 50-entry scan, 50 - 25 free slots; a two-list variant with a 75-entry active list lost none.
- The kernel behaviour is taken from the v6.12 source comment.