Home/Labs/Write-Around Pollution Guard
All 280 Labs
INTERACTIVE LAB🚫

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 rounds imported
0
Hot keys resident
4/4
Hot read hit ratio
—
Extra DB queries
0
Redis RAM slots 4/8 (head = most recent)Hot set 4/4 protected
H:catalog
HOT
H:cart
HOT
H:session
HOT
H:profile
HOT
free
free
free
free
Event log

› Bulk import writes are routed Write-Around: hot working set fully resident (4/4).

Cold writes landing on disk while reads lazily cache only what is requested keeps the hot working set pinned in RAM. This is the Dropbox pattern: 5GB uploads stream to S3, Redis only sees metadata when someone opens the file.

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.
Interview Round Script

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.

Key Trade-Offs

Complete immunity to cache pollution in exchange for a guaranteed first-read miss on every newly written record.

Related Curriculum Chapter

Write-Around Caching

Read Full Chapter Blueprint

Explore More Interactive Labs

View All 280 Labs