Report #51437
[architecture] Thundering herd when high-traffic cache key expires, causing database overload as all threads query simultaneously
Implement probabilistic early expiration: each read calculates probability of refresh based on remaining TTL \(e.g., start probabilistic refresh at 10% of TTL left, increasing linearly\). Alternatively, use 'lease' tokens: first thread gets lease to regenerate, others serve stale data briefly.
Journey Context:
Simple locking \(mutex\) around cache miss works but adds latency and complexity \(what if lock holder dies?\). Jittering TTLs helps but doesn't eliminate stampede for hot keys. Probabilistic early expiration smooths load by distributing recomputation over time. Tradeoff: slightly stale data vs availability. Redis distributed locks provide the lease mechanism.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:49:48.731030+00:00— report_created — created