Quick revision
The short answer
Immediately, I would protect the databases so they can recover: shed or rate-limit non-critical traffic, keep critical paths such as login and checkout running, stop retry storms, and warm the most important keys in a controlled way instead of letting all traffic refill the cache at once, then reopen traffic gradually. Afterwards I would change the assumptions: every capacity plan must state whether its database survives a cold cache, the shared starter gets request coalescing, stale fallbacks and concurrency limits on cache-miss paths, we run planned cold-cache tests, and we consider replicated or multi-zone cache deployments so one failover does not empty everything.
What to remember
In this answer, we handled a regional Redis failover that left every cache empty. Immediately, we protected the databases by shedding non-critical traffic, rate-limiting with priority for critical paths and stopping retry storms, then warmed the most important keys with limited concurrency and reopened traffic step by step. Afterwards, we made capacity plans state whether each database survives a cold cache, added request coalescing, stale fallbacks and miss-path concurrency limits to the shared starter, introduced planned cold-cache tests, and reviewed the cache deployment so replicas across zones keep data through a failover.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Immediately, I would protect the databases so they can recover: shed or rate-limit non-critical traffic, keep critical paths such as login and checkout running, stop retry storms, and warm the most important keys in a controlled way instead of letting all traffic refill the cache at once, then reopen traffic gradually. Afterwards I would change the assumptions: every capacity plan must state whether its database survives a cold cache, the shared starter gets request coalescing, stale fallbacks and concurrency limits on cache-miss paths, we run planned cold-cache tests, and we consider replicated or multi-zone cache deployments so one failover does not empty everything.
Why this question is asked
Most systems are sized for their normal hit ratio. If 95 percent of reads are served by the cache, the database only needs to handle 5 percent, and over time the database is quietly downsized to match. That works until the cache is empty. A regional Redis failover that loses its data turns 200 services into a single load test that nobody planned, against databases that were never sized for it. Interviewers ask this scenario to see how an architect leads an incident and then fixes the system rather than the symptom. In this answer, we will see why the databases fail, go through the immediate actions in order, plan controlled warming, and then the lasting changes to capacity planning, the shared starter, testing and cache deployment.
1Why an Empty Cache Takes Down the Databases
Take a database that serves a service with a 95 percent cache hit ratio. If the service receives 20,000 reads per second, the database handles 1,000. With an empty cache, all 20,000 go to the database, a twenty-fold increase, and they are not spread out: every service starts missing in the same second. The database's connection pools fill, queries queue, latency rises, clients time out and retry, which adds even more load. Several services share each database, so the slowest one drags down the others. And because each miss would refill the cache only after a slow query completes, the cache refills slowly, which keeps the load high. Without intervention this state can last much longer than the failover itself.
2Immediate Actions: Give the Databases Room
The first goal is not to refill the cache; it is to bring database load below its capacity so queries complete again. Everything else depends on that.
- Declare the incident, one coordinator200 services need one plan, not 200
- Shed non-critical trafficfeature flags off: recommendations, reports, search suggestions
- Rate-limit at the edgeprotect login, checkout, payments first
- Stop retry stormsdisable aggressive client retries, extend backoff
- Databases recovering?YesStart controlled warmingNoShed more traffic
- Warm the most important keyslimited concurrency, from replicas where possible
- Reopen traffic graduallywatch database CPU and latency at each step
7 steps in order. Play them, or step through them one at a time.
Shedding means deliberately rejecting some requests, with fast errors or simplified responses, so that the rest succeed. We turn off non-critical features with feature flags: recommendations, personalised banners, report generation. At the edge or API gateway we rate-limit traffic per route, with the highest limits on critical paths such as login, checkout and payments. We also stop the retry storm: clients that retry immediately on timeouts multiply load, so we disable or slow retries where we can. Once database CPU and latency fall below their limits, queries complete, the cache starts refilling, and we can move to warming.
3Warming the Cache in a Controlled Way
Letting all traffic refill the cache is the most expensive way to warm it, because the first requests for each key all miss together. Instead, we warm the most important keys on purpose. Most services know their hot keys: the home page catalog, the top 10,000 products, configuration and feature data. A warming job loads them with limited concurrency, for example 20 queries at a time per database, preferably from read replicas so the primaries keep serving writes. Within minutes the hit ratio for the busiest traffic is back near normal, and the long tail of colder keys fills naturally as traffic returns.
Then we reopen traffic in steps, for example 25, 50, 75 and 100 percent, or one feature at a time, watching database load after each step. Turning everything back on at once could recreate the overload with a half-warm cache.
4Afterwards: Capacity Plans That Survive a Cold Cache
The root cause is an assumption: that the cache is always warm. The post-incident change is to make that assumption explicit. Every capacity plan must state, per database, whether it can survive its services' cold-cache load, and if not, how the services degrade. For some databases the answer will be to add capacity. For most, it will be to make the services behave better on misses, because sizing every database for twenty times its normal load is expensive. Either way, a hit ratio is no longer allowed to be an unstated input to database sizing.
5Afterwards: Protective Defaults in the Shared Starter
With 200 services, the most effective change is in the shared caching starter, so every service gets it with an upgrade. Request coalescing, letting one load per key run while concurrent callers wait for its result, turns thousands of identical misses into one query per key per instance. A stale fallback, keeping a small local copy of recent values, lets services keep answering with slightly old data when the shared cache is empty. And a concurrency limit on the cache-miss path, a bulkhead of, say, 50 concurrent database loads per instance, caps how much any single service can hit its database, with fast fallback responses beyond the limit.
- Edge rate limits and load sheddingcritical routes first
- Local stale copy (L1)serves slightly old values
- Request coalescingone load per key per instance
- Concurrency limit on missesfor example 50 loads per instance, then fallback
- Databasesees a bounded load, even with Redis empty
5 layers, from the top down. Step through them one at a time.
6Afterwards: Test It and Reduce the Blast Radius
Assumptions only stay true if we test them. We run planned cold-cache tests, game days in a staging environment and later in production at quiet hours, where we flush a cache cluster on purpose and watch what happens to each database. Each test either confirms the capacity plan or finds the next weak service before an incident does.
We also ask why one failover emptied everything. A properly replicated Redis setup should fail over to a replica that already holds the data. So we review the deployment: replicas in a different zone, failover that promotes a replica rather than starting an empty node, and possibly persistence so a restarted node comes back warm. We also consider splitting the single regional cluster so that one failure does not affect all 200 services at once.
7Follow-up questions
Why not simply restart Redis or fail back immediately?
Restarting does not bring the data back unless persistence or replicas hold it, and a second failover can make things worse by emptying the cache again just as it was refilling. The priority is database recovery; the cache cluster's own repair can happen in parallel, carefully, once the databases are stable.
How do you choose which traffic to shed?
Ideally in advance. Each service classifies its routes by criticality as part of its runbook, so in an incident the coordinator can say shed everything below tier 1 instead of negotiating with 200 teams. Revenue and safety-critical paths, such as payments and login, are tier 1; personalisation and analytics are usually the first to go.
8Conclusion
In this answer, we handled a regional Redis failover that left every cache empty. Immediately, we protected the databases by shedding non-critical traffic, rate-limiting with priority for critical paths and stopping retry storms, then warmed the most important keys with limited concurrency and reopened traffic step by step. Afterwards, we made capacity plans state whether each database survives a cold cache, added request coalescing, stale fallbacks and miss-path concurrency limits to the shared starter, introduced planned cold-cache tests, and reviewed the cache deployment so replicas across zones keep data through a failover.
Open with
My first goal would be to get the databases below their capacity, not to refill the cache, because nothing recovers while queries are timing out. So I would run it as one incident with one coordinator and act in order.
Then, if they want more
Shed non-critical traffic, turning off recommendations, reports and similar features with flags. Rate-limit at the gateway, with priority for login, checkout and payments. Stop retry storms by disabling aggressive client retries.
Once database CPU and latency come down, I would warm the most important keys deliberately, the hot catalog, top products and configuration, with limited concurrency and from read replicas if possible, rather than letting all traffic refill the cache with simultaneous misses. Then I would reopen traffic in steps and watch the databases at each step.
Afterwards, I would fix the assumption that the cache is always warm. Every capacity plan must say whether its database survives a cold cache, and if not, how the services degrade. In the shared starter I would add request coalescing, a stale local fallback, and a concurrency limit on cache-miss paths, so 200 services get protection with an upgrade.
I would run planned cold-cache tests, game days where we flush a cluster on purpose. And I would review why a failover emptied everything: replicas in another zone, failover that promotes a warm replica, maybe persistence, and splitting the cluster to reduce blast radius.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Cache abstraction
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "A regional Redis failover leaves the cache empty for all 200 services that use it, and...": https://scrivio-interview-library.netlify.app/databases/caching/c1fe348e2b/