Interview Prep/Real-World Interview/Scaling and performance

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 →

  1. Restore the cache (failover to the ElastiCache replica, or restart).
  2. Protect the DB while the cache warms: rate-limit at the edge, shed non-critical traffic, temporarily cap app replicas.
  3. Prevent stampedes: request coalescing (one request repopulates a key while others wait), jittered TTLs so keys don't expire together, and stale-while-revalidate.
  4. Make the cache HA: ElastiCache with Multi-AZ and automatic failover.
  5. 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.

All Real-World Interview questions Roadmap: Interview readiness

More on Scaling and performance