⚡ ~/naveed Interview Prep
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Databases & Storage Interview Questions Scenario 45 of 52 in Databases & Storage
Principal Systems Architect Database Redis & In-Memory Caching High-Throughput Architecture

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.

#Redis #Cache Stampede #Thundering Herd #Bloom Filter #Distributed Locking #High Concurrency
🎙️ Candidate Opening & Architectural Context
"Cache stampede (or thundering herd / dogpiling) occurs when a heavily queried cache key expires, causing concurrent application threads to simultaneously compute the expensive query and hit the database. Cache penetration occurs when queries for non-existent entities bypass the cache entirely because the keys are never present, continuously thrashing the database."
Advertisement
⚡ Recommended Practice Lab

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

Advertisement
⚡

Action: Mutex Locking, Probabilistic Early Expiration (XFetch) & Bloom Filters

⚡

Result: 99.8% RDS Query Reduction & Sub-5ms p99 Latency

💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Never rely solely on simple TTL expiration for hot keys. Use probabilistic early background re-computation (XFetch), Redis mutex locks for stampede mitigation, and Bloom filters or cached null values to defeat cache penetration."
⚡ 60-Second Elevator Pitch Talking Points
  • 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.
Advertisement
Want more Databases & Storage scenarios?
Explore our complete collection of scenario-based Databases & Storage interview runbooks.
Browse All Databases & Storage Questions →