Problems / Async and streaming, hard
Asked at Airbnb, Netflix and Uber. A scheduler API calls job runners synchronously, and each job takes 400 ms. Cron schedules line up, so at 6 s and 16 s ten times the usual jobs fire for 3 seconds, and at 9 s a runner dies mid-job.
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.9%, no job run twice, no job lost, for at most $18,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 3; 1 of them are hidden until then.
600 requests a second for 20 seconds: 100% job (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 Scheduler API.Layer 4 balancers route by IP and port; layer 7 balancers read HTTP and can route by path or header. | – |
| Scheduler APIApp service | Load balancer forwards to it.Calls Job runners.Little's law: throughput ≈ concurrency ÷ latency. 200 slots at 50 ms serve about 4,000 req/s. | 4 replicas × 100 slots · timeout 4.0 s |
| Job runnersApp service | Scheduler API calls it.Calls Job runs (Postgres).Little's law: throughput ≈ concurrency ÷ latency. 200 slots at 50 ms serve about 4,000 req/s. | 8 replicas × 100 slots · timeout 4.0 s |
| Job runs (Postgres)SQL database | Job runners calls it.Postgres runs one process per connection, which is why poolers like PgBouncer sit in front of busy databases. | 8 vCPU · 400 connections |