.NET Architecture & System Design Interview Question #35
What is cache penetration?
Caching, CDN, Queues & Asynchronous Processing Junior Beginner
Quick Interview Answer
Cache penetration occurs when requests repeatedly ask for data that does not exist, causing every request to miss the cache and reach the database or downstream service.
Detailed Explanation
Cache penetration occurs when requests repeatedly ask for data that does not exist, causing every request to miss the cache and reach the database or downstream service.
A common mitigation is negative caching: cache the fact that the item was not found for a short period. Input validation, rate limiting, or probabilistic structures can also help for particular workloads.
Code Example
Request missing ID
|
Cache miss
|
Database: not found
|
Cache "not found" briefly