Backend Engineering · System design · Hard
System design practice: Snow Day in Shimla
So many orders that the database is mostly writing. Snow Day in Shimla at ChaiCart. Traffic builds to about 17,000 requests a second. 2 things go wrong…
The problem
- Snow Day in Shimla at ChaiCart. Traffic builds to about 17,000 requests a second. 2 things go wrong at once tonight. Keep 99% of customers served and stay within ₹4,750.
- Peak ≈ 17,000 req/s
- From 7:48 PM: 45% of traffic is bots
- ≈ 2,338 writes/s at peak on the main database
You'll use: System design · Caching · CDN · Queues & workers · Database replicas · Rate limiting
Show a hint
Bots make far more requests than people. A rate limiter blocks them before you pay to serve them. Traffic that's identical for everyone (the offer page) belongs on the CDN. Set it up before the spike: servers take minutes to boot. Repeat reads of the same data belong in a cache, not in more database replicas.
What this teaches (spoiler)
Not all traffic deserves capacity: shed abusive clients at the door. Prepare for spikes you can see coming, and push identical content to the edge. Read-heavy traffic is a caching problem first: answer repeat reads from memory.