Problems / Async and streaming, hard
Asked at Uber, DoorDash and Airbnb. A marketing campaign sends notifications through an API that calls the push provider directly and retries twice. At 6 s the campaign triples the rate for 8 seconds, the provider’s quota is 150,000 a minute, and at 15 s the provider is down for 8 seconds.
Unlock it once for 25 credits; everything inside it is free (runs, changes, Submit, results, hints). Sign in with Google to start; new accounts get free credits.
Success ≥ 99.5%, no duplicate pushes, no lost notifications, for at most $260,000 a month.
Like a coding problem, a solution has to pass every case, not just the one it was built for. Submit in the lab runs all 2; 1 of them are hidden until then.
3,000 requests a second for 20 seconds: 100% notify (writes).
What each component does in this design, and what calls it. The simulator mimics each one from these settings.
| Component | Its job here | Settings |
|---|---|---|
| Load balancerLoad balancer | Traffic enters here.Calls Notification API.Layer 4 balancers route by IP and port; layer 7 balancers read HTTP and can route by path or header. | – |
| Notification APIApp service | Load balancer forwards to it.Calls Push provider A.Little's law: throughput ≈ concurrency ÷ latency. 200 slots at 50 ms serve about 4,000 req/s. | 6 replicas × 100 slots · timeout 2.5 s |
| Push provider ANotification service | Notification API calls it.Email, SMS and push providers all throttle senders and can delay delivery. | 200 slots · 150,000 calls/min |