open atlas
↑ Back to track
System Design Foundations SD · 05 · 06

Caching at scale: free-recall review

Free-recall prompts across the caching unit. Answer each in your own words first — strategy and consistency, eviction and hit-ratio math, sharding and the stampede, invalidation and the source-of-truth rule — then reveal the model answer and compare.

SD Senior ◷ 14 min
Level
FoundationsJuniorMiddleSenior

Retrieval beats re-reading. For each prompt, say or write a full answer from memory — including the arithmetic — before you open the model answer. The effort of reconstructing the strategy tradeoff, the hit-ratio math, the stampede fix, and the source-of-truth rule is what makes them stick.

Reconstruct the unit’s spine without looking back: what each caching strategy promises, what eviction and TTL trade, why hit ratio (not size) is the metric, how to shard and survive node loss, what a stampede is and how to stop it, and why the cache is never the source of truth.

Recall before you leave
  1. 01
    Name the five caching strategies, split into read-path and write-path, and state what each promises.
  2. 02
    What do eviction and TTL each handle, what does each eviction policy bet, and why approximate LRU?
  3. 03
    Why is hit ratio the metric, and how do you compute the DB load from a hit-ratio change?
  4. 04
    Why shard a cache with consistent hashing, what does replication add, and what is a cache stampede + its fixes?
  5. 05
    State the three invalidation approaches, the write-time race and its fix, and the source-of-truth rule.
Recap

If you could reconstruct each answer from memory, you hold the unit’s spine. The five strategies split read-path (cache-aside, read-through) from write-path (write-through, write-back, write-around), each promising a different mix of freshness, miss cost, and durability — composed one-of-each per data class. Eviction handles space (LRU is the default access-aware bet, never noeviction for a cache) and TTL handles time (jitter it). The metric is the hit ratio, because the DB feels the miss rate — 99%→90% hits is a 10× DB load spike. Scaling out needs consistent hashing (only ~1/N keys move on rescale) and replication (async, slightly stale), and must defend the stampede with single-flight while handling hot keys and cold start. Invalidation trades staleness against coupling across TTL, explicit delete, and versioned keys — versioning beats delete because it escapes the write-time race — and the deepest rule is that the cache is a disposable copy, never the source of truth. The thread tying it together: at this depth, caching is reasoning about tradeoffs and failure modes you choose up front, not behavior you discover in production.

Something unclear?

Ask a question about this lesson. Questions are anonymous and go straight to the author to make the lesson better.

shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.