{
  "slug": "cache-pollution",
  "term": "Cache pollution",
  "aliases": [
    "cache scan pollution"
  ],
  "definition": "Cache pollution occurs when cached data displaces other data whose retention would provide greater benefit to the workload.",
  "note": "A scan can cause misses after the scan itself has finished. [car]\n\nReuse count alone does not define benefit. Prefetched data can be useful on its first demand access. Eviction before that use is prefetch wastage. [amp]\n\nA scan is any sequence of one-time requests, and under LRU it can displace pages with lasting value. [car] 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. [car] [arc]\n\nSequential scans are a common cause of noticeably worse interactive response times. [lirs] 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. [twoq] 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. [ws]",
  "status": "research",
  "advantages": [],
  "limitations": [
    {
      "text": "In 2Q, protection depends on admission history and workload as well as resident capacity; history-size tuning can help some traces and hurt others.",
      "citationIds": [
        "twoq",
        "miniature"
      ]
    }
  ],
  "related": [
    "lru-replacement",
    "mapping-cache",
    "adaptive-replacement-cache",
    "cache-admission",
    "sieve-eviction",
    "clock-replacement",
    "prefetch-wastage",
    "prefetch-trigger-distance",
    "ghost-cache-entry",
    "page-cache",
    "working-set",
    "locality-of-reference",
    "two-queue-replacement",
    "dulo"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-31",
  "citations": [
    {
      "id": "car",
      "title": "Sorav Bansal and Dharmendra S. Modha. CAR: Clock with Adaptive Replacement. FAST 2004; sections III-V.",
      "url": "https://www.usenix.org/legacy/events/fast04/tech/full_papers/bansal/bansal.pdf",
      "accessed": "2026-10-15"
    },
    {
      "id": "hesela",
      "title": "Hesela: mapping caches, scan phases and cache-history semantics (constructed examples)",
      "url": "https://hesela.com/analyses/ssd-mapping-cache-hmb/#scan-pollution",
      "accessed": "2026-10-15"
    },
    {
      "id": "amp",
      "label": "Gill and Bathen, FAST 2007",
      "title": "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.",
      "url": "https://www.usenix.org/legacy/event/fast07/tech/full_papers/gill/gill.pdf",
      "accessed": "2026-10-18"
    },
    {
      "id": "arc",
      "title": "Megiddo and Modha. ARC: A Self-Tuning, Low Overhead Replacement Cache. USENIX FAST 2003, pp. 115-130.",
      "url": "https://www.usenix.org/event/fast03/tech/full_papers/megiddo/megiddo.pdf",
      "accessed": "2026-10-16"
    },
    {
      "id": "twoq",
      "title": "Johnson and Shasha. 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994, pp. 439-450.",
      "url": "https://www.vldb.org/conf/1994/P439.PDF",
      "accessed": "2026-10-16"
    },
    {
      "id": "lirs",
      "title": "Jiang and Zhang. LIRS: An Efficient Low Inter-reference Recency Set Replacement Policy to Improve Buffer Cache Performance. SIGMETRICS 2002.",
      "url": "https://xiaodongzhang1911.github.io/Zhang-papers/TR-02-6.pdf",
      "accessed": "2026-10-16"
    },
    {
      "id": "ws",
      "title": "Linux v6.12 mm/workingset.c, leading comment on double CLOCK lists and shadow entries.",
      "url": "https://github.com/torvalds/linux/blob/v6.12/mm/workingset.c",
      "accessed": "2026-10-16"
    },
    {
      "id": "miniature",
      "title": "Waldspurger, Saemundsson, Ahmad and Park. Cache Modeling and Optimization using Miniature Simulations. USENIX ATC 2017, sections 2 and 4.2.",
      "url": "https://www.usenix.org/system/files/conference/atc17/atc17-waldspurger.pdf",
      "accessed": "2026-10-31"
    }
  ],
  "provenance": [
    "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."
  ]
}
