Design a Live Streaming Platform
Understanding the Problem
📡 What is a live streaming platform? A live streaming platform lets a broadcaster send video as it happens, and viewers watch it seconds later. Twitch streams games, Facebook and Instagram Live stream from phones, and services like Hotstar or YouTube stream live sports to enormous audiences. Unlike video on demand, there is no file to prepare in advance: every segment is created, transcoded, packaged and delivered within a few seconds of being filmed.
This question comes in several forms: "design Twitch," "design Facebook Live," "design live sports streaming for a cricket final," "design live comments." They're one problem with different dials. Twitch has many concurrent streams, mostly small, with chat as a core feature and low latency so streamers can talk to their audience. Facebook and Instagram Live add mobile broadcasting over shaky cellular networks and friends-first comments. Live sports has few streams but one gigantic audience that arrives all at once. We'll design one platform and cover each variant in the deep dives.
Functional Requirements
Core Requirements
- Broadcasters should be able to go live, from desktop software (OBS) or a phone.
- Viewers should be able to watch a live stream with a short delay and quality that adapts to their network.
- Viewers should be able to post comments and see other viewers' comments in near real time.
Below the line (out of scope)
- Discovery, search and recommendations of live channels.
- Monetization: subscriptions, tips, ads.
- Clips and highlights.
- Interactive sub-second formats like multi-person co-streaming (see /system-design/video-conferencing for that real-time model).
Non-Functional Requirements
Ask your interviewer which variant they have in mind, because the numbers differ a lot. We'll design for both of these:
- Everyday load: 100,000 concurrent live streams and 20 million concurrent viewers.
- A big event: one stream (a cricket or football final) with 50 million concurrent viewers, most on phones, arriving within minutes of the start.
Core Requirements
- Glass-to-glass latency (camera to viewer's screen) should be 2-5 seconds for interactive streams, and no worse than about 10 seconds for sports.
- The system should scale to tens of millions of concurrent viewers on a single stream, and absorb the spike when they arrive.
- Playback should adapt to network conditions and rebuffer rarely.
- A stream must not drop mid-broadcast because a server failed. Big events need redundancy end to end.
- Comments should appear for other viewers within a second or two.
Below the line (out of scope)
- Exactly-once comment delivery. Seeing most comments in order is fine; missing a few in a busy stream is fine.
- Strict synchronization between viewers (two viewers a second apart is acceptable).
The arithmetic:
- Ingest: 100k streams × 6 Mbps = 600 Gbps coming in, spread across regions.
- Transcoding: each stream becomes a ladder of 4-5 renditions, in real time. That's 100k continuous transcode jobs that can never fall behind, the most compute-heavy part of the platform.
- Everyday egress: 20M viewers × 3 Mbps = 60 Tbps.
- The big event: 50M viewers × 1.5 Mbps (mostly mobile) = 75 Tbps for one stream.
Sometimes the interviewer says "1 billion concurrent viewers." Do the math with them: even at 1 Mbps that's 1 Pbps for one stream, which is on the order of the combined capacity of several of the largest CDNs. Real-world records for a single live event are in the tens of millions. It's fine to say this, then design for the largest number that's plausible and explain what you'd add beyond it (multi-CDN, ISP caches, lower bitrates, peer-assisted delivery). Pushing back with numbers is a good signal; pretending it's easy is not.