Skip to content
SD-7 · System design

Design a Video Streaming

Asked at Senior level45 minutes
Our answers stay hidden until you reveal them.

Design a video service where creators upload videos and viewers watch them on phones, laptops and TVs. A viewer presses play and the video starts within a couple of seconds, then keeps playing smoothly as their network gets better or worse. Creators upload files of up to a few gigabytes, and the video becomes watchable a few minutes later.

The service has 200 million daily viewers who watch about 1 billion videos a day, and creators upload 500,000 new videos a day. At peak about 14 million people watch at once, which is over 40 Tbit/s of video. The hard parts are the bytes and the CPU: every upload must be encoded into several sizes, which costs about 2 CPU-hours a video, and every second of playback must reach the viewer before the player’s buffer runs dry, from wherever in the world they are.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1Video on demand or live?
  2. 2How big are uploads?
  3. 3Which devices?
  4. 4How fast must a new upload be watchable?
  5. 5Do we need DRM?
  6. 6Can creators edit a video after upload?
  7. 7Do view counts have to be exact?
  8. 8Do we need recommendations and search?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough