Code Room
System designHardsd-g313
Subject CachingLevel Mid–Senior~35 minCommon in Distributed systems interviewsIndustries Technology

Question

A social feed service caches the rendered timeline for celebrity accounts. One celebrity's cached timeline (a 200KB object, expensive to regenerate — ~800ms, touching 5 backend services) is read 80,000 times per second. When its TTL expires, all 80k concurrent readers miss simultaneously and stampede the regeneration path, melting the backends every TTL cycle. Design stampede protection for this exact scale. Quantify why naive locking isn't enough and describe the mechanism that keeps origin regenerations to roughly one per TTL while keeping reader latency flat.

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.