Code Room
System designMediumsd-g638
Subject ConcurrencyLevel Mid–Senior~35 minCommon in Concurrency interviewsIndustries Technology, Software development

Question

Design a concurrent cache with single-flight (dogpile / thundering-herd prevention) in front of an expensive backend (e.g. a 300ms recommendation computation) serving 100k req/sec across many app servers. Constraints: when a hot key expires, the backend must be called once, not by every concurrent miss, stale-but-fast responses are acceptable briefly, and a slow recompute must not cascade into backend overload. Describe the cache layout, how concurrent misses for the same key are coordinated, and the recompute path.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.