Pattern · seen in 2 breakdowns across 2 companies
Load-Bearing Cache
When a database can handle only the reads its cache misses, losing the cache can take the system down, not just slow it: every read it was answering now hits the database at once.
The mechanism
At its core: the database can serve only part of peak traffic on its own, so the cache's hit rate is real capacity. Let the hit rate drop too far and the database is overloaded, and the outage does not fix itself.
Empty a cache past the point of no return and the database goes down with it - protect the cache and it holds.
Definition
A cache starts as a speed-up: the system still works without it, just slower. At scale that can stop being true. To save money, the database behind the cache is often given only enough capacity to handle the reads the cache misses, because the cache is expected to answer most reads. The share of reads the cache answers is called its hit rate. If the hit rate drops far enough, too many reads reach the database at once and it can no longer keep up.
Now the cache is load-bearing: the system depends on it to stay up, not just to stay fast. Losing the cache is no longer a slowdown - it can take the system down. Worse, the outage often keeps itself going. Once the database is overloaded, it starts failing the very reads that would refill the cache, so the cache stays empty and the database stays overloaded.
The pattern is the discipline for systems where the cache has become load-bearing. It has four parts:
- know the breaking point - treat the hit rate like a capacity limit, and find the hit rate below which the database can no longer keep up when traffic is at its peak
- protect the cache during maintenance - routine work like replacing or restarting nodes empties part of the cache; do it in small steps, and do not clear the cache unless you have to
- fill a node before it serves - when a node starts up empty, fill it with data before it takes real traffic, instead of putting an empty node in front of users
- watch for hidden expensive reads - some reads are cheap only because the cache hides their cost, like reads that hit many shards or join large tables; each one gets far more expensive the moment the cache is empty
One limit on all this: if losing the cache only makes the system slower, you do not need any of it. These habits are for the case where the honest answer to 'can the database handle the traffic without the cache?' is no.
When it applies
Tradeoffs
The same move, 2 ways
Every row is a production system that bet on this pattern — the note says how, in that system's own terms.
Problems this pattern answers
The walls where its breakdowns live — each opens the cross-company comparison.