Your Redis cache went down and the database fell over right after. Explain and fix.
AdvancedScenarioScaling and performance
Answer
Situation read → Cache stampede. The DB was sized for cache-miss traffic only; losing the cache sent 100% of reads to it.
What I'd do →
- Restore the cache (failover to the ElastiCache replica, or restart).
- Protect the DB while the cache warms: rate-limit at the edge, shed non-critical traffic, temporarily cap app replicas.
- Prevent stampedes: request coalescing (one request repopulates a key while others wait), jittered TTLs so keys don't expire together, and stale-while-revalidate.
- Make the cache HA: ElastiCache with Multi-AZ and automatic failover.
- Load test the "cache empty" scenario so you know the DB's real limit.
Why → Once the cache carries most reads, it is part of your capacity. Its failure mode must be designed, not discovered.
Interview tip → Say "the cache is part of capacity planning" and mention jittered TTLs.
More on Scaling and performance
Traffic is expected to 10x for a sale next week. How do you prepare the platform?IntermediateThe HPA is configured but pods don't scale even though the app is slow. Why?BeginnerPods are Pending during a traffic spike because the cluster is out of capacity. What do you do now and long term?IntermediateThe database CPU is at 95% and the API is timing out. What's your approach?Intermediate"Too many connections" errors from Postgres after scaling the app out. How do you fix it?IntermediateLatency is fine on average but p99 is terrible. Where do you look?Advanced