Netflix
Video streaming at global scale using pre-positioned content on Open Connect appliances, adaptive-bitrate playback, a microservices control plane, and personalized recommendations.
By Ratish Jain · Updated
Problem
Design Netflix: stream a catalog of movies and shows to hundreds of millions of subscribers with high quality and near-zero rebuffering, plus a personalized home screen.
Unlike user-generated video, Netflix's catalog is finite and known in advance, which unlocks a decisive optimization: pre-position encoded content on edge appliances inside ISP networks before anyone presses play. The rest is a microservices control plane for auth, playback authorization, and recommendations, kept resilient with patterns like circuit breakers.
Functional Requirements
- Browse a personalized catalog with ranked rows.
- Play any title with adaptive bitrate on many device types.
- Resume playback across devices (bookmarks).
- Search titles; show details and similar content.
- Recommendations tuned to each profile's history.
Non-Functional Requirements
- Sub-2-second start time; minimal rebuffering globally.
- Extreme availability — a failing microservice must degrade gracefully.
- Massive read/stream scale; egress dominated by video bytes.
- Efficient network usage via ISP-local content.
- Fast catalog browse experience (personalized, cached).
Capacity Estimation
- Subscribers
- ~250M profiles
- Concurrent streams (peak)
- ~tens of millions
- Peak egress
- ~15%+ of global internet traffic
- Catalog size
- ~thousands of titles, each many renditions
- Encoded storage
- ~PBs, replicated to Open Connect appliances
- Control-plane QPS
- millions of API req/s across microservices
APIs
- GET /home
- getHomeRows(profileId) → RankedRow[]
- POST /playback
- authorizePlay(profileId, titleId) → {manifest, edgeUrls}
- POST /bookmark
- saveProgress(profileId, titleId, positionMs)
- GET /search
- search(query, profileId) → Title[]
Components
- API gateway: edge entry point routing to control-plane microservices; handles auth and fanning out home-page calls.
- Playback service: authorizes a play, picks the best appliance, and returns a manifest + edge URLs.
- Recommendation service: ranks catalog rows per profile from offline-trained models + online signals.
- Metadata / catalog DB: title info, artwork, manifests, and encoding references.
- Open Connect Appliances (OCA): Netflix-owned caching servers placed inside ISPs, pre-loaded with popular content.
- Steering / control service: directs each client to the healthiest, closest OCA.
Request Flow
- 1Client hits the API gateway for the home screen; the reco service returns ranked rows (heavily cached).
- 2User presses play; the request routes to the playback service.
- 3Playback authorizes the subscription/title and fetches the manifest from the catalog DB.
- 4Steering selects the optimal Open Connect appliance for the client's location/ISP and returns edge URLs.
- 5The client's player streams video segments directly from the OCA — control plane is no longer in the path.
- 6The player runs ABR, switching bitrates by measured bandwidth; progress is periodically bookmarked.
Flow Diagram
Data / Storage Design
Because the catalog is finite, Netflix encodes each title once, offline, into a per-title-optimized ABR ladder and pushes those files to Open Connect appliances during off-peak hours. So the 'storage' of video is really a distribution problem: which titles sit on which appliances, predicted from regional popularity.
The control plane uses many purpose-fit datastores (e.g. Cassandra for viewing history and bookmarks, caches for the catalog, a search index). Recommendations are computed in offline batch/ML pipelines and served from precomputed, cached ranking results, refreshed continuously.
Data Model
Scaling Strategy
The killer strategy is pre-positioning: video bytes are already inside the viewer's ISP before playback, so streaming avoids Netflix's origin and long-haul transit entirely. This is what makes serving ~15% of internet traffic feasible.
The control plane scales as independently deployable microservices, each owning its data and scaling to demand. Resilience patterns — circuit breakers, bulkheads, and timeouts (popularized by Netflix's Hystrix) — ensure a slow recommendation service can't take down playback; the UI degrades to a generic row instead.
Bottlenecks & Failure Scenarios
- Cascading microservice failure: prevented with circuit breakers, bulkheads, and fallbacks (serve a default home row).
- OCA cold/miss for a surprise-hit title: fall back to a regional/origin fill while pre-positioning catches up.
- Reco pipeline lag: serve last-good cached rankings; recommendations are non-critical for playback.
- Regional appliance overload: steering redirects clients to nearby healthy OCAs.
- Thundering herd on a new-release drop: pre-warm appliances ahead of the scheduled release time.
Design Tradeoffs
- Pre-positioned ISP-local content gives excellent quality and slashes transit cost.
- Microservices allow independent scaling and rapid, isolated deploys.
- Resilience patterns keep playback working even when peripheral services fail.
- Pre-positioning only works for a known catalog — useless for live/UGC.
- Microservice sprawl adds operational and observability overhead.
- Placing and refreshing content on thousands of appliances is complex logistics.
Common Interview Questions
Netflix has a finite, known catalog, so it encodes offline and pre-positions content on ISP-embedded Open Connect appliances before playback. YouTube must transcode unbounded user uploads on demand and can't pre-position everything, relying more on a general CDN.
Circuit breakers, timeouts, and bulkheads isolate failures, and services provide fallbacks — e.g. if recommendations are down, show a generic popular row. Non-essential features degrade instead of breaking playback.
Streaming is bandwidth-dominated. Placing content at the ISP edge means bytes travel a short last-mile hop instead of crossing the internet backbone, cutting latency, rebuffering, and cost dramatically.
- →Finite catalog → encode offline, pre-position on Open Connect at ISPs.
- →Control plane authorizes play; bytes stream edge-direct.
- →Microservices scale independently with circuit breakers/bulkheads.
- →Recommendations precomputed offline, served cached and degradable.
- →Pre-positioning is why Netflix can serve internet-scale egress.
Related
Everything on Archprimer is connected — follow the graph.