Illustrative simulation. The values come from a model, not a measured production system.
Interactive Lab · Cache Protection
When the Redis cache key for the IPL Final score expires at 10:00 PM, 500 concurrent users hit refresh at the same second. Compare Naive Cache-Aside vs Single-Flight Mutex to see how to prevent database collapse.
Guided Walkthrough: What to do and what to watch
-
Step 1 (The Outage): Select "Naive Cache-Aside" and click "Slam 500 Readers (Key Expired)".
What you will see: All 500 requests bypass the expired cache. The PostgreSQL card turns red and vibrates with a100% CPU OVERLOADalert. The connection pool maxes out at100/100, and 340+ requests fail withHTTP 504 Gateway Timeout. -
Step 2 (The Solution): Switch to "Single-Flight Mutex" and click "Slam 500 Readers" again.
What you will see: The API Gateway card turns blue (holding a group mutex). 499 requests await one promise in memory while exactly 1 query queries PostgreSQL. DB CPU stays at8%, and all 500 requests resolve in 42ms with 0 errors! -
Step 3 (Warm Cache Hit): Click "Warm Up Cache".
What you will see: Redis turns emerald green (HIT). P99 latency drops to0.8 ms, completely bypassing the database.
500 Readers
ClientsIdle
API Gateway
Concurrency ControlPass-through
Redis Cache
Key: ipl:scoreTTL: EXPIRED
PostgreSQL
Source of TruthIdle (2% CPU)
Database CPU Load
2%
DB Active Conns
2 / 100
P99 Response Time
1.8 ms
Failed Requests
0 (0%)
Learn the idea behind it
The demo shows what breaks. The lesson explains why it breaks, and what you give up with each fix.
This demo is free. The System Design pass (₹499) opens all 28 demos, 36 design interview problems and 75 Docker labs. See what the pass includes →