Start Here

Tier 1 · Building Blocks

Scale Reads

Scale Writes

Database Selection

Traffic Control

Consistency & Coordination

Estimation

Tier 2 · Core Systems

Tier 3 · Location & Real-Time

Tier 4 · Infrastructure & Data

Tier 5 · Finance & Commerce

Tier 6 · Advanced & Collaborative

Phase 1 — Clarify & Scope

Interviewer: Design Twitch — a live video streaming platform. What do you want to clarify?

Candidate: Key questions:

  1. Both live streaming (broadcast) and VOD (replay past streams)?
  2. What's the scale — concurrent streamers and viewers?
  3. What's the key latency requirement — broadcast delay from streamer to viewer?
  4. Chat and interactive features (polls, subscriptions, donations)?
  5. Adaptive bitrate streaming — do we transcode to multiple quality levels?

Interviewer: Both live and VOD. 8 million concurrent viewers, 100,000 concurrent streamers. Target latency: < 6 seconds (standard) with a low-latency mode < 3 seconds. Include chat. Yes to adaptive bitrate — transcode to 360p, 480p, 720p, 1080p. Focus on the video pipeline.

Candidate: Let me size this:

Ingest bandwidth=100,000 streamers×6 Mbps avg=600 Gbps ingest\text{Ingest bandwidth} = 100{,}000 \text{ streamers} \times 6 \text{ Mbps avg} = 600 \text{ Gbps ingest}

Delivery bandwidth=8M viewers×4 Mbps avg=32 Tbps delivery\text{Delivery bandwidth} = 8\text{M viewers} \times 4 \text{ Mbps avg} = 32 \text{ Tbps delivery}

Transcoding load=100,000 streams×4 quality levels=400,000 transcoding jobs\text{Transcoding load} = 100{,}000 \text{ streams} \times 4 \text{ quality levels} = 400{,}000 \text{ transcoding jobs}

The delivery-to-ingest ratio is 32 Tbps / 600 Gbps ≈ 53× — CDN is essential; we cannot serve all viewers from origin.

Interviewer: What are the core requirements?

Candidate:

  • Accept RTMP stream from streamers, transcode to multiple quality levels (HLS/DASH adaptive)
  • Distribute video to millions of concurrent viewers with < 6 second latency
  • Low-latency mode: < 3 second end-to-end delay
  • Live chat: messages visible to all viewers within 2 seconds
  • VOD: past streams stored and searchable
  • Stream health monitoring: alert streamer if their upload quality degrades

Non-functional:

  • 99.99%…

In the full tutorial

  • Phase 2 — High-Level Architecture
  • Phase 3 — Deep Dive & Evolution
  • Phase 4 — Robustness & Operations

Glossary history

Click dotted jargon to save explanations here.