Problems / Real world, hard
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.
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.
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.
6,000 requests a second for 20 seconds: 50% play (reads), 45% browse (reads), 5% license (reads).
What each component does in this design, and what calls it. The simulator mimics each one from these settings.
| Component | Its job here | Settings |
|---|---|---|
| DDoS protectionDDoS protection | Traffic 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 gateway | DDoS 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 service | API 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 database | Playback 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 stream | Playback 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)Worker | Playback 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 database | Event processors (Flink) calls it.Time-series databases compress by time and downsample old data to keep storage small. | 250 slots |
| Browse APIApp service | API 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 model | Browse 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 service | API 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 server | License 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 |