What happens to your system if the entire cache tier is flushed at peak traffic?
Show the full answer Hide the answer
What the interviewer is testing
Whether you know your system's behaviour without its cache — which most teams do not, because it has never happened.
What happens
Every request becomes an origin request. If the cache was serving a 95% hit rate, the origin's load increases twentyfold instantaneously.
The origin was almost certainly not provisioned for that. It saturates, latency rises, requests queue, callers time out and retry — which adds more load. And the cache cannot repopulate, because the queries that would populate it are queued behind thousands of duplicates of themselves.
This is a cache stampede at total scale, and systems in this state frequently do not recover on their own even after the triggering event has passed.
The uncomfortable question
Can your origin serve full traffic at all? If not, the cache is not a performance optimisation — it is a load-bearing component, and its availability requirement is as high as the service's. Most teams have not classified it that way, and its operational treatment reflects that.
The mitigations
Request coalescing. The first miss for a key acquires a lock and fetches; concurrent requests wait for its result. This turns twenty thousand origin calls into one and is the single most effective control.
Staged warming. Repopulate deliberately before taking full traffic rather than under load.
Load shedding at the origin, so it serves what it can at acceptable latency rather than collapsing for everyone.
TTL jitter, so entries populated together do not expire together — which prevents the everyday version of this.
Stale-while-revalidate, so an expired entry is still served while a refresh happens in the background, meaning expiry never produces a synchronous miss.
What a strong answer adds
Distinguishing the causes, because they have different likelihoods: a deliberate flush during a deployment, a cache cluster restart, a node loss with modulo-based key distribution remapping everything, or an eviction storm from a memory limit.
The modulo case is worth calling out — adding cache capacity remaps nearly every key and produces exactly this outage, which is why consistent hashing exists.
Common weak answers
Increasing cache size. Assuming the origin can handle it without checking.