Problems / Design a product, hard

Build YouTube: the full interview

Design YouTube the way a senior system-design interview expects: resumable uploads and a transcoding pipeline, adaptive playback through a CDN, a sharded metadata store behind a cache, two-stage recommendations, search, comments and view counting, then survive a viral video, a cold CDN, a cold cache, an upload surge, a slow ranker, a stream outage and a DDoS attack.

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.

What it must do

Scale

Request types to route: watch (40%, read), view (30%, write), home (14%, read), search (8%, read), comment (5%, write), upload (3%, write). Budget: $16,000 a month.

Estimate first

The test cases

You start from an empty canvas. When you run the tests, each one simulates your design with its own traffic and failures:

TestWhat it doesPasses when
Normal dayThe normal day: the traffic in the brief, nothing broken.Success ≥ 99.8%; p99 latency ≤ 300 ms (watch); p99 latency ≤ 400 ms (home); p99 latency ≤ 500 ms (search); Success ≥ 99.8% (upload); Success ≥ 99.8% (view)
A video goes viralAt 5 s a video goes viral and the app sends a push notification: all traffic quadruples for 8 s, almost all of it people starting playback.Success ≥ 99%; p99 latency ≤ 600 ms (watch); p99 latency ≤ 800 ms (home)
The CDN goes coldAt 5 s the video CDN is emptied, as after a bad config push or a new edge site coming online: every playback start misses at the edge and goes to your origin until the edge warms up again (about 30 s).Success ≥ 99%; p99 latency ≤ 800 ms (watch)
The metadata cache is flushedAt 5 s the video metadata cache is emptied, as after a restart or a bad deploy: every metadata read (manifests at the origin, titles and thumbnails on home feeds and search results) goes to the database until the cache warms up again.Success ≥ 99%; p99 latency ≤ 800 ms (watch)
Upload surge: the encoder farm falls behindAt 5 s a surge of uploads (a big event ends and everyone posts their clips) saturates the encoder farm: every encode takes 10× longer for 10 s.Success ≥ 99% (upload); p99 latency ≤ 1.5 s (upload); Success ≥ 99%
Recommendations 10× slowerAt 5 s the recommendation ranker answers 10× slower for 8 s, as after a bad model push or a lost accelerator pool.Success ≥ 99% (home); p99 latency ≤ 800 ms (home)
The view event stream goes downAt 5 s the view event stream crashes; it comes back after its restart time (10 s unless you set one). While this test runs, brokers redeliver unacknowledged messages after 5 s and 0.2% of acknowledgements are lost, as in production: only idempotent consumers avoid duplicates.No lost events; No duplicate side effects; Success ≥ 99% (view)
DDoS attackAt 5 s 30,000 requests a second of flood traffic arrive for 10 s, alongside real users.Attack blocked ≥ 95%; Success ≥ 99%; p99 latency ≤ 400 ms (watch)
Budget: $16,000/monthThe normal day's design must cost at most $16,000 a month.Cost ≤ $16,000/month

Must include

More design a product problems