Write-Around Caching Lab (Interactive)
Flood the cache tier with cold bulk uploads and watch LRU sacrifice hot keys — or bypass the cache and stay clean. Replay a bulk-import storm against an 8-slot cache to see cache pollution in action and how write-around protects the hot working set.
Write-Around vs Cache Pollution Lab
Flood the cache with cold bulk uploads and watch LRU evict your hot user data — or bypass it entirely.
Write Path
› Bulk import writes are routed Write-Around: hot working set fully resident (4/4).
How It Works Under the Hood
Write-Around sends writes directly to the database or object store, skipping the cache entirely; data enters RAM only when a reader asks for it (Cache-Aside on reads). It exists to stop cache pollution: a bulk import of 100,000 invoices routed Write-Through would flood RAM, and LRU would evict hot profiles and session tokens to make room, cratering hit ratios for real users. Dropbox uploads 5GB files straight to S3 and caches only metadata when someone opens the file. The one cost: the first read of freshly written data always misses.
Core Architectural Principles
- Writes bypass cache; only explicit reads lazily populate hot entries with a TTL.
- Write-Through on cold bulk data evicts the hot working set — the cache-pollution churn cycle.
- Pairing Write-Around writes with Cache-Aside reads lets cold data upgrade itself if it becomes hot.
Pick Write-Around the moment a design includes large media uploads, ETL batches, or archival logs, and explain the failure mode you avoid: "cold bulk writes would flood RAM and LRU would evict active sessions, tanking hit ratio for real users." Close by pairing it with Cache-Aside reads so genuinely hot data still enters the cache naturally.
Complete immunity to cache pollution in exchange for a guaranteed first-read miss on every newly written record.