System Design: Design Netflix Video Streaming
On this page
The problem: design a video streaming service
Users browse a catalog, pick a title and watch it on phones, laptops and TVs, on networks from fast fiber to weak mobile. Playback must start quickly and not stall. New titles are uploaded by a content team. Design it for a few million daily viewers.
The number that matters: egress bandwidth
Viewers 3M daily × 1 hour average
Bitrate ~5 Mbit/s for HD
Peak concurrency ~600,000 streams (evening peak)
Peak egress 600,000 × 5 Mbit/s ≈ 3 Tbit/s3 terabits per second can't come from a few origin servers. Almost all of it must be served from caches near viewers. That single number drives the architecture. Metadata requests are tiny by comparison.
Video ingest and transcoding
When the content team uploads a master file:
- Store it in object storage.
- A transcoding pipeline splits it into chunks and encodes each in parallel into an encoding ladder: several resolutions and bitrates (for example 240p at 0.4 Mbit/s up to 4K at 15 Mbit/s), in modern codecs (H.264 for compatibility, plus HEVC, VP9 or AV1 for efficiency).
- Each rendition is cut into segments of a few seconds, with a manifest listing them (HLS
.m3u8or MPEG-DASH.mpd). - Outputs go to object storage and are published to the CDN.
Encoding is a large batch job across many workers, driven by a queue (Day 42): ideal for elastic compute. Netflix has described encoding each title per scene, tuning bitrates to content complexity.
Storage multiplies too. With an example ladder of 0.4, 1, 2, 3, 5, 8 and 15 Mbit/s, one hour of content is about 34 Mbit/s summed across renditions:
34 Mbit/s × 3,600 s ÷ 8 ≈ 15 GB per hour of content, per codec
10,000 hours of catalog ≈ 150 TB per codec, before the masters and replicasEvery extra codec adds another full ladder, which is why services encode newer, more efficient codecs only for popular titles where the bandwidth savings repay the storage.
Playback and adaptive bitrate streaming
The player downloads the manifest, then segments one by one. It measures download speed and buffer level and picks the rendition for the next segment: higher quality when the network is good, lower when it drops. That's adaptive bitrate streaming (ABR). Quality changes slightly instead of the video stopping. Startup is fast because the player begins with a low rendition and steps up.
Video delivery: CDN and DRM
Segments are static files, so they're perfect for CDNs (Day 35): cached at edges near viewers, with long TTLs. Popular titles are pre-positioned at edges before release, during off-peak hours. Netflix built its own CDN, Open Connect, placing caching servers inside internet providers' networks; smaller services use commercial CDNs, often more than one for resilience.
Content protection uses DRM (Widevine, FairPlay, PlayReady): segments are encrypted, and a license service issues keys to authorized players.
The license service is on the critical path in a way the CDN isn't: every playback start needs a license. A CDN outage in one region hurts that region; a license service outage stops every new stream everywhere. Run it active-active across regions, cache licenses on the device for their allowed period, and give it its own SLO.
Catalog, recommendations and resume position
- Catalog metadata (titles, cast, artwork): a database plus heavy caching; rarely changes, read constantly.
- Personalized home rows: recommendation models computed offline or near-real-time from viewing events, served from a fast store. If personalization is down, show popular titles.
- Viewing events (play, pause, position every few seconds) stream through Kafka for analytics and recommendations (Day 43).
- Resume position: a small write per user and title, stored in a highly available key-value store; "continue watching" reads it.
What a strong video streaming design includes
- Egress bandwidth identified as the dominant problem, and CDN delivery as the answer.
- Encoding into a ladder of renditions and segments, as a scalable batch pipeline.
- Adaptive bitrate explained from the player's side.
- Separate, much smaller systems for metadata, recommendations and viewing state.
- Fallbacks: popular titles if personalization fails, multiple CDNs.
- Storage per codec estimated, and the license service treated as critical.
Check yourself
So the player can switch quality between segments as network conditions change, avoiding stalls, and so segments can be cached as ordinary files.
CDN edges close to viewers, because peak egress is far beyond what origin servers can supply, and nearby edges reduce latency and stalls.
Fall back to non-personalized rows, such as popular, trending or new titles, possibly cached. The home screen keeps working, users can still browse and play, and only personalization is temporarily lost. Recommendations should never be a hard dependency of starting playback.
The DRM license service. New playback needs a license and existing streams already have one. Make it multi-region and cache licenses on devices.