All jobs / DevOps / SRE / cloud
DevOps / SRE / cloud interview question · 3–5 years
A hot cache key expires and 5,000 requests miss at once. Design against it.
The strongest answer
Coalesce: the first miss takes a lock or a single-flight slot and rebuilds while the others wait or serve the stale value; add early refresh before expiry with jittered TTLs so keys do not expire together; the database sees one read, not thousands
Why it works
Right. Single flight, stale-while-revalidate, jitter.
What a good answer covers
- One rebuild, others wait or serve stale.
- Refresh before expiry.
- Jitter TTLs.
- DB sees one read.
Answers that fall short
- Close, but not the strongest: Increase the TTL so it expires less often
Then the stampede is rarer, and just as bad. - Weak: Add more database replicas to absorb the misses
Replicas absorb some; the storm still hits. - Red flag: Warm the cache once at startup
Startup warming does not help expiry.
Who gets asked this
- Backend developer
- Full-stack developer
- DevOps / SRE / cloud
- Data engineer
- Data science / ML / AI
- Engineering manager / tech lead
- Solutions / cloud architect
- AI engineer
More DevOps / SRE / cloud questions
- How do you limit the blast radius of a failure in a system serving millions?
- Your DR runbook is a document. How do you make it real?
- A user has an allow policy for an action and their group has a deny for it. What happens?
- URL shortener: how do you generate the short code?
- A service on a VM needs to read from a storage bucket. How does it get permission?
- Design a rate limiter: which algorithm and where does its state live?
- Active-passive versus active-active across regions — what does active-active cost you beyond money?