Design Netflix video streaming: CDN, adaptive bitrate, content encoding pipeline, and recommendation system.
Published April 24, 2025
Functional: Stream videos, Browse catalog, Search, Recommendations, Multiple device/quality support Scale: 230M subscribers, 15% of global internet traffic, 8K streams per second peak
Video files are huge (1 hour HD = 3-5 GB). You cannot serve them from a single origin server.
Origin Servers (AWS S3) → CDN Edge Servers (worldwide) → Users
Netflix's Open Connect:
- Netflix deploys its own CDN appliances directly at ISPs
- Popular content pre-positioned at the edge
- User requests served from nearest edge (< 10ms latency)
The same video is stored at multiple quality levels. The client switches quality based on available bandwidth.
Video encoded at:
4K (15 Mbps)
1080p (8 Mbps)
720p (4 Mbps)
480p (2 Mbps)
360p (1 Mbps)
Each quality level is split into 4-second segments.
Client player:
1. Download manifest (list of all segment URLs per quality)
2. Measure download speed of last segment
3. Choose quality for next segment based on bandwidth
4. Buffer 10-30 seconds ahead
Protocol: HLS (HTTP Live Streaming) or DASH (Dynamic Adaptive Streaming over HTTP)
Original Video Upload
↓
[Encoder Farm (AWS) — parallel encoding]
↓ (different resolutions, codecs: H.264, H.265, AV1)
[S3 Storage]
↓
[CDN Push — pre-position at edge based on popularity prediction]
-- Metadata (MySQL + Elasticsearch for search)
videos: video_id, title, description, duration, genres[], cast[]
-- Viewing history (Cassandra)
view_history: user_id, video_id, watch_position, updated_at
-- Recommendations (offline ML pipeline → Cassandra)
recommendations: user_id, video_ids[], model_version, generated_at
Client → DNS → Edge Location → CDN
↓ (metadata/auth)
API Gateway → [Catalog Service | User Service | Recommendation Service]
↓
[MySQL] [Cassandra] [Elasticsearch]
↓
[Kafka → ML Pipeline → Recommendations]