Code AnalysisBeginner 60s
Cache aside stampede on hot key expiry
A hot product key expires and 5,000 concurrent requests all miss and hit the DB at once.
What failure mode is shown?
Starter code
val = cache.get(key)
if val is None:
val = db.query(key) # all 5k requests run this
cache.set(key, val, ttl=60)
return valThink you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.