Playbook

Debugging Cache Stampedes

How to recognize and contain request spikes when cached data expires.

Pattern

Many callers miss cache at once and regenerate the same expensive value.

warningSymptoms

  • arrow_rightLatency jumps at predictable intervals
  • arrow_rightDatabase or upstream pool saturation
  • arrow_rightRetries make the spike worse

searchWhere to look

  • arrow_rightCache TTLs
  • arrow_rightLock or single-flight guards
  • arrow_rightFallback behavior
  • arrow_rightHot key metrics

buildCommon fixes

  • arrow_rightAdd request coalescing
  • arrow_rightStagger TTLs
  • arrow_rightServe stale while revalidating
  • arrow_rightProtect upstream calls

Practice challenges