Runtyme
All practice problems

Backend Engineering · System design · Hard

System design practice: App Store Feature

So many orders that the database is mostly writing. App Store Feature at ChaiCart. Traffic builds to about 13,000 requests a second. 3 things go wrong at…

The problem

  • App Store Feature at ChaiCart. Traffic builds to about 13,000 requests a second. 3 things go wrong at once tonight. Keep 99% of customers served and stay within ₹5,900.
  • Peak ≈ 13,000 req/s
  • ⚠ Payments slow down from 7:38 PM. 28% of requests are checkouts
  • From 7:47 PM: 30% of traffic is bots
  • ≈ 2,503 writes/s at peak on the main database

You'll use: System design · Caching · CDN · Queues & workers · Database replicas · Rate limiting

Solve it (expert level)2–3 min · No coding needed
Show a hint

Bots make far more requests than people. A rate limiter blocks them before you pay to serve them. Repeat reads of the same data belong in a cache, not in more database replicas. Don't make servers wait on slow payments: queue checkouts and let workers (~300/s each) handle them.

What this teaches (spoiler)

Not all traffic deserves capacity: shed abusive clients at the door. Read-heavy traffic is a caching problem first: answer repeat reads from memory. Never let a slow third party hold your servers hostage. Queue the work and reply immediately.

Bug of the Day: a new problem every midnight, free for everyone. Keep a streak with your friends.