advancedTop 30 Scenario-Based Questions
How do you prevent a cache avalanche in production?
Cache avalanche: many keys expire simultaneously → DB flooded. Prevention: 1) Randomize TTL: don't set uniform TTL. Instead of TTL=3600, use TTL = 3000 + random(0,600). Keys expire spread over 10 minutes instead of all at once. 2) Eternal cache + async refresh: never expire critical keys. Background job proactively refreshes before data is too stale. 3) Circuit breaker on DB: if DB load spikes (av
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
How do you prevent a cache avalanche in production?