Loading…
Caching questions cover cache-aside patterns, invalidation, stampede protection and edge delivery — usually the largest single latency win in a design.
Caching is the first optimisation reached for in a system design interview and the one most often described too vaguely to earn credit. A cache is a decision about staleness: which data may be served slightly out of date, for how long, and what happens when the cached copy disappears. Content delivery networks are the same idea applied geographically, moving bytes closer to the user.
The follow-ups are always invalidation and failure. Interviewers ask how a stale entry is corrected, what happens when the cache is cold or an entire node is lost, and whether a spike of simultaneous misses can overwhelm the database behind it. Naming the stampede problem and a specific mitigation, and stating a time-to-live with a reason rather than a round number, are what separate a designed cache from a decorative one.
11 system design · 2 cloud architecture · 3/4/6 easy/medium/hard
When a popular entry expires and many concurrent requests all miss and hit the database at once. Mitigations include staggered expiry, a lock so only one request refreshes, and serving stale data while a refresh happens in the background.
From how stale the data is allowed to be, not from a habit. Tie it to a stated requirement — a feed can tolerate minutes, a permission check cannot — and say what corrects the entry sooner when the source changes.