Lesson 2 of 16
40. Design Video Upload and Streaming (YouTube)

40.1 What do you ask first?

3 min read+10 XP

Step 1: Requirements (5 minutes)

LetterCandidate asksInterviewer answers
Scope"Upload, process, watch? Live streaming? Comments, recommendations, search? Max upload size?""Upload, process and watch, plus view counts. Live is a separate round (Chapter 41). Skip comments and recommendations. Uploads up to a few GB, sometimes more."
Count"How much is uploaded and watched?""Say 500 hours of video uploaded every minute, and about a billion hours watched a day."
Access pattern"How skewed is viewing?""Very: a small share of videos gets most of the views."
Latency"How soon after upload must a video be watchable? How fast should playback start?""Within minutes of upload. Playback should start in a second or two and rarely stall."
Exactness"Must view counts be exact and live?""Roughly right and a few minutes behind is fine, but not inflatable by bots."

Agreed requirements:

  • Functional (verbs): creators upload (resumable); the system processes videos into many qualities and formats; viewers watch with adaptive quality; the system counts views.
  • Non-functional (adjectives): durable originals, fast processing (minutes), smooth playback (quick start, few stalls) on any network and device, global delivery at enormous bandwidth, cost-aware storage and egress, trustworthy view counts.

Interviewer pushback:

  • "Why not just store the uploaded file and stream it?" → The original might be a 4K file a phone can't decode or a slow network can't carry. We need a ladder of qualities and formats, cut into segments, so every device and network can play something (Chapter 26).

Memory code: "Ask how much goes in, how much comes out, and how fast it must be watchable."