Metadata
| Field | Value |
|---|---|
| Slug | netflix |
| Difficulty | Advanced |
| Estimated Reading Time | 20 min |
| System Focus | Massive Read Throughput, Network Architecture, Data Pipelines |
| SEO Description | Learn how to design a video streaming service like Netflix in a system design interview. Covers Open Connect CDNs, Video Transcoding pipelines, and Edge Computing. |
Building Blocks Used
This case study builds upon the following foundational concepts:
- Content Delivery Network (CDN) (Open Connect video delivery)
- Caching Strategies (Minimizing backend load)
- Load Balancer (Distributing global traffic)
1. System Requirements
Functional Requirements
- Users can browse a catalog of movies and TV shows.
- Users can stream videos smoothly with minimal buffering.
- The system must support varying internet speeds (Adaptive Bitrate Streaming).
- The system remembers where the user stopped watching (Watch History).
Non-Functional Requirements
- Massive Bandwidth: Must serve exabytes of video data globally without crippling the internet backbone.
- High Availability: Streaming cannot go down.
- Low Latency (Time-to-First-Frame): Videos must start playing almost instantly.
2. Back-of-the-Envelope Estimation
- Active Users: 200 Million.
- Concurrent Users (Peak): 20 Million globally.
- Video Bitrate: Assume an average of 5 Mbps (Megabits per second) for 1080p HD.
Network Bandwidth (Peak)
- 20,000,000 users × 5 Mbps = 100,000,000 Mbps = 100 Terabits per second (Tbps).
- Takeaway: 100 Tbps is an astronomical amount of traffic. You cannot serve this from a centralized AWS datacenter. It would melt the undersea internet cables. We must use a globally distributed CDN (Content Delivery Network).
3. High-Level Architecture
The architecture is fundamentally split into three distinct planes:
- The Control Plane (Backend API): Runs on AWS. Handles logins, billing, search, recommendations, and deciding which CDN the user should stream from.
- The Data Plane (CDN): Runs on Netflix Open Connect (OCAs). Handles the actual pushing of heavy video bytes to the user's TV.
- The Ingestion Pipeline: Runs on AWS. Converts raw Hollywood video files into streamable formats.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ffcc00', 'edgeLabelBackground':'#ffffff'}}}%%
graph TD
classDef client fill:#f9f9f9,stroke:#333,stroke-width:2px;
classDef aws fill:#ff9900,stroke:#232f3e,stroke-width:2px,color:#fff;
classDef cdn fill:#e50914,stroke:#b20710,stroke-width:2px,color:#fff;
C((User Device)):::client -->|1. Get Playback URL| API[AWS: API Gateway]:::aws
API --> PlaySvc[AWS: Playback Service]:::aws
PlaySvc -->|2. Find closest CDN| Tracker[AWS: CDN Tracker]:::aws
PlaySvc -->|3. Return URL| C
C -->|4. Stream Video| OCA[Open Connect Appliance<br/>ISP Edge Server]:::cdn
Studio[Hollywood Studio]:::client -->|Upload 4K Master| Transcode[AWS: Transcoding Pipeline]:::aws
Transcode -->|Distribute| OCA
4. Deep Dive: The Transcoding Pipeline
When a studio uploads "Stranger Things", they provide a massive, uncompressed ProRes master file (often >1 TB for an episode). You cannot stream this to a phone on 3G.
The file must be Transcoded.
- Chunking: The master file is split into 4-second chunks.
- Parallel Processing: These chunks are distributed across thousands of AWS EC2 instances.
- Encoding: Each chunk is encoded into different resolutions (480p, 720p, 1080p, 4K) and different formats (H.264, AV1, HEVC) to support everything from a 10-year-old iPhone to a brand new LG OLED TV.
- Audio: Audio is stripped and encoded separately in multiple languages and formats (Stereo, Dolby Atmos).
A single episode might result in 1,200 different files to support all combinations of screens, resolutions, and internet speeds.
Adaptive Bitrate Streaming (ABS)
The Netflix player on your TV constantly monitors your internet speed. If your Wi-Fi suddenly drops, the player seamlessly switches to downloading the 480p chunks instead of the 4K chunks, preventing the video from buffering.
5. Deep Dive: Open Connect (The Custom CDN)
To solve the 100 Tbps bandwidth problem, Netflix built its own custom CDN called Open Connect.
Instead of renting servers from AWS or Akamai globally, Netflix builds physical server racks called Open Connect Appliances (OCAs) and ships them for free to Internet Service Providers (ISPs) like Comcast, AT&T, and Vodafone.
The ISPs install these red boxes directly inside their own local datacenters.
Why?
- When you press play on Netflix, the video is not coming from Virginia or Ireland. It is coming from a box sitting in a datacenter 5 miles from your house.
- This entirely bypasses the global internet backbone, ensuring lightning-fast speeds and saving ISPs millions of dollars in bandwidth transit costs.
Cache Proactive Population
An OCA box only holds about 200TB of hard drives. It cannot hold the entire Netflix catalog. Every night during off-peak hours (e.g., 3:00 AM), AWS calculates which shows are most popular in that specific geographic region. AWS then pushes those specific video files down to the local OCA boxes. (e.g., French OCAs receive "Lupin", while US OCAs receive "Stranger Things").
6. Deep Dive: The Control Plane (AWS)
While video flows from the CDN, all business logic happens in AWS.
The Playback Service
When you click play, your app calls POST /playback.
The Playback Service must determine the optimal OCA box for you. It considers:
- Your IP address / Geo-location.
- The health and load of nearby OCAs.
- Does the nearby OCA actually have the specific movie in the specific resolution your device requested?
Watch History
Every few seconds, your player pings AWS with a heartbeat: "I am at 1h:23m:10s". This is a massive, constant write load. Netflix uses Cassandra for this. It is a highly scalable LSM Tree NoSQL database that handles millions of writes per second with ease.
7. Bottlenecks & Trade-offs
The Thundering Herd (New Releases)
When a highly anticipated show drops at midnight, millions of users hit the AWS API simultaneously. Solution: Netflix heavily relies on Caching Strategies. They cache metadata (titles, descriptions, thumbnails) aggressively in memory using EVCache (their custom wrapper around Memcached).
Storage vs Compute
Transcoding a video into 1,200 different formats requires a massive amount of upfront CPU compute time on AWS, and it drastically increases the total storage required. Trade-off: Storage is cheap. Bandwidth and buffering are expensive. Spending millions on AWS compute to compress videos as efficiently as possible saves Netflix hundreds of millions in global bandwidth costs and ensures a flawless user experience.
8. Summary of Building Blocks Used
| Component | Purpose in this Architecture |
|---|---|
| CDN | Open Connect is the heart of Netflix. Pushing heavy video assets to the very edge of the network prevents the internet from collapsing under the load. |
| SSTable & LSM Tree | Cassandra handles the immense, continuous write volume generated by millions of users saving their watch history progress every few seconds. |
| Caching Strategies | Memcached (EVCache) absorbs the read-heavy load of the catalog browsing experience, keeping the main databases safe. |
| Database Replication | User profile and billing data require strict consistency and are stored in multi-region replicated MySQL databases. |
Website Metadata
| Field | Value |
|---|---|
| Hero Title | Design Netflix |
| Hero Subtitle | How to build a global video streaming platform capable of delivering 100 Tbps of data without crashing the internet. |
| Breadcrumb | System Design → Case Studies → Netflix |
| Sidebar Category | System Design |
| Search Keywords | netflix, system design, video streaming, cdn, open connect, transcoding, adaptive bitrate |
| Suggested Illustration | A massive reel of film being chopped into tiny puzzle pieces by a laser, then shot out across a global map to small red boxes. |
| Suggested Animation | A user clicks play. A signal goes to a cloud (AWS), which points to a red box right next to the user's house. The red box instantly blasts a stream of video to the TV. |