Skip to content
Latchkey

What Is Cache Stampede Protection?

Cache stampede protection is a set of techniques that stop a crowd of clients from simultaneously recomputing the same expensive value when a popular cache entry disappears. Common approaches let one client recompute while others wait or serve a slightly stale value. The aim is to avoid the thundering-herd load spike a naive cache suffers.

Why it matters

When a hot key expires, every concurrent request misses and tries to regenerate it at once, hammering the backing system exactly when it is busiest. Protection mechanisms like single-flight locking or early recomputation keep that regeneration to one worker. In CI, a stampede on a shared cache backend can stall many runners at the same moment.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →