What are cache penetration, breakdown and avalanche?
Assesses fundamental understanding of Caching Strategies conventions, runtime behavior, and memory/performance considerations.
Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.
Three classic failure modes, often confused:
- Penetration: requests for keys that do not exist always miss the cache and hit the database. Attackers can exploit this with random ids. Mitigate by caching null or empty results for a short TTL, using a Bloom filter to reject impossible keys, or validating input.
- Breakdown: a single very hot key expires and many requests hit the database simultaneously. Mitigate with a mutex, logical expiry, or never-expiring hot keys refreshed in the background.
- Avalanche: many keys expire at the same moment, or the cache restarts and is empty, causing a flood to the backend. Mitigate with randomized TTLs, warming the cache, and using a highly available clustered cache.
penetration: non-existent key -> always misses
breakdown: hot key expires -> stampede
avalanche: mass expiry/restart -> flood
Add circuit breakers and load shedding on the database so a cache incident degrades gracefully rather than taking the whole system down. Monitor miss rate and backend load together to detect these patterns.
Candidate Response Strategy & Interview Tips
- Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
- Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
- Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
- Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.