Q: A high-traffic e-commerce landing page experiences a Redis cache expiration on a hot product catalog key ('catalog:flash_sale:2026'). 50,000 concurrent requests hit the cache simultaneously, find a cache MISS, and dogpile the underlying PostgreSQL database, instantly driving RDS CPU to 100% and taking down checkout. Simultaneously, malicious scrapers query non-existent product IDs, causing continuous cache penetration. How do you eliminate the thundering herd and cache penetration?
Protect relational databases from instant collapse during hot key cache expirations and malicious cache penetration attacks using distributed locks, XFetch probabilistic caching, and Bloom filters.
Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Situation: Hot Key Expiry Triggers Database Overload
Task: Eliminate Database Dogpiling & Block Non-Existent Entity Penetration
Action: Mutex Locking, Probabilistic Early Expiration (XFetch) & Bloom Filters
Result: 99.8% RDS Query Reduction & Sub-5ms p99 Latency
- Cache stampede occurs when thousands of concurrent threads query the database on a single key expiration.
- Use distributed mutex locks or probabilistic early background refresh to ensure only 1 worker queries the database.
- Use RedisBloom filters to block non-existent queries before they ever reach the persistent database layer.