Layer 3 · Go deeper · 11 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How many cores does encoding keep busy?
How much video leaves the network at the evening peak?
How many metadata reads a second reach the database?
Build-up · 5 steps
Build the high-level design
One functional requirement at a time, ending with a YouTube that works end to end before any scaling.
Step 1 of 5
Upload and become watchable
Never push gigabytes through API servers. The upload service creates the row and a session; bytes land in object storage, and an event queues the encode, so a slow encoder never fails an upload.
6 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 6
Interviewer
“A creator in Patna uploads a 20 GB wedding video over a 10 Mbps uplink: about 4.4 hours. How do you get it in?”
Your move. Pick an approach:
Deep dive 2 of 6
Interviewer
“A 10-minute 1080p upload needs six H.264 rungs plus audio, thumbnails and checks. How do you run the encoding?”
Your move. Pick an approach:
Deep dive 3 of 6
Interviewer
“You add about 3 EB of video a year, and most uploads are watched a handful of times. Which renditions does each video get?”
Your move. Pick an approach:
Deep dive 4 of 6
Interviewer
“A viewer’s train enters a tunnel and throughput dips from 8 to 2 Mbps. How does the player avoid a spinner?”
Your move. Pick an approach:
Deep dive 5 of 6
Interviewer
“Assume 200 Tbps at the evening peak, from a catalogue of exabytes with an extreme long tail. Where do the bytes come from?”
Your move. Pick an approach:
Deep dive 6 of 6
Interviewer
“A fan’s IPL clip gets 1,400 new viewers a second, and bots are watching too. How do you count views?”
Your move. Pick an approach:
Build-up · 5 steps
Follow one video to its millionth view
Three planes share one video ID. The only thing on a view’s hot path is a cache: the edge for bytes, the metadata cache for the watch page.
Step 1 of 5
Upload
The upload service creates the row and a session. 16 MiB parts go straight to object storage in parallel, so no API server touches the bytes. complete verifies checksums and commits the original.