Problems / Real world, hard

Premiere night: video at three times the traffic

Asked at Netflix and YouTube. Every video segment is served by origin servers reading object storage, manifests come from Postgres, and DRM licenses from license servers, all through the same origin fleet. At 6 s a premiere starts and traffic triples for 12 seconds; at 13 s the segment storage is unavailable for 4 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.

Your goals

Success ≥ 99.5%, p99 ≤ 1.5 s and Apdex ≥ 0.90 through the premiere, for at most $100,000 a month.

Test cases

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.

  1. As given. The problem’s own traffic, scheduled failures and seed.
  2. A slow dependency. The main data store or model answers twice as slowly for part of the run.

The traffic

15,000 requests a second for 20 seconds: 90% segment (reads), 8% manifest (reads), 2% license (reads).

The system

What each component does in this design, and what calls it. The simulator mimics each one from these settings.

ComponentIts job hereSettings
Load balancerLoad balancerTraffic enters here.Calls Origin servers.Layer 4 balancers route by IP and port; layer 7 balancers read HTTP and can route by path or header.–
Origin serversApp serviceLoad balancer forwards to it.Calls Video segments (object storage), Titles and manifests (Postgres), DRM license servers.Little's law: throughput ≈ concurrency ÷ latency. 200 slots at 50 ms serve about 4,000 req/s.20 replicas × 100 slots · timeout 3.0 s
Video segments (object storage)Object storageOrigin servers calls it for /segment.Object stores like S3 keep copies across devices and facilities for very high durability.3000 slots · 300,000 calls/min
Titles and manifests (Postgres)SQL databaseOrigin servers calls it for /manifest.Postgres runs one process per connection, which is why poolers like PgBouncer sit in front of busy databases.8 vCPU · 400 connections
DRM license serversDRM license serverOrigin servers calls it for /license.Protected video is encrypted once; the player fetches a short-lived key from a license server before it can play.400 slots

More real world problems