Problems / Real world, hard

Netflix: from launch build to real traffic

Netflix without Open Connect or EVCache: every request reaches the origin, title metadata is read from the catalog database each time, and the playback, browse, license and recommendation services are an eighth of their real size. 6,000 requests a second: half are playback starts, 45% browsing, 5% DRM licenses. Playback starts fail.

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

Grow it into the real architecture: every goal must hold at 6,000 requests a second. You may add components, connect them and resize anything.

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 6; 2 of them are hidden until then.

  1. As given. The problem’s own traffic, scheduled failures and seed.
  2. Peak hour. 25% more traffic than the problem states, with the same failures.
  3. A slow dependency. The main data store or model answers twice as slowly for part of the run.
  4. A server dies. One replica of the service with the most replicas is killed for part of the run.

The traffic

6,000 requests a second for 20 seconds: 50% play (reads), 45% browse (reads), 5% 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
DDoS protectionDDoS protectionTraffic enters here.Calls API gateway (Zuul).Volumetric floods are absorbed at the network edge, spread over many locations, before they reach you.100000 slots
API gateway (Zuul)API gatewayDDoS protection forwards to it.Calls Playback API, Browse API, License API.Gateways centralise auth, rate limits and routing so each service does not reimplement them.50000 slots · 1,500,000 calls/min
Playback APIApp serviceAPI gateway (Zuul) forwards to it for /play.Calls Catalog (Cassandra), Playback events (Kafka) (publishes).Little's law: throughput ≈ concurrency ÷ latency. 200 slots at 50 ms serve about 4,000 req/s.1 replicas × 100 slots · timeout 1.0 s
Catalog (Cassandra)Document databasePlayback API calls it for reads. Browse API calls it for reads.Document databases store nested JSON-like records, so one read can fetch a whole aggregate.100 slots
Playback events (Kafka)Event streamPlayback API publishes to it.Calls Event processors (Flink).Kafka keeps order only within a partition, so the partition key decides what stays in sequence.8 partitions · retention 600 s
Event processors (Flink)WorkerPlayback events (Kafka) consumes from it.Calls Viewing history and metrics.Queues deliver at least once, so a worker can see the same message twice.16 concurrent jobs
Viewing history and metricsTime-series databaseEvent processors (Flink) calls it.Time-series databases compress by time and downsample old data to keep storage small.250 slots
Browse APIApp serviceAPI gateway (Zuul) forwards to it for /browse.Calls Catalog (Cassandra), Recommendation ranker.Little's law: throughput ≈ concurrency ÷ latency. 200 slots at 50 ms serve about 4,000 req/s.1 replicas × 100 slots · timeout 1.0 s
Recommendation rankerRanking modelBrowse API calls it.Feeds rank a few hundred candidates per load with a learned model; retrieval narrows millions of posts first.128 slots
License APIApp serviceAPI gateway (Zuul) forwards to it for /license.Calls DRM license server.Little's law: throughput ≈ concurrency ÷ latency. 200 slots at 50 ms serve about 4,000 req/s.1 replicas × 100 slots · timeout 2.0 s
DRM license serverDRM license serverLicense API calls it.Protected video is encrypted once; the player fetches a short-lived key from a license server before it can play.75 slots

More real world problems