Netflix
Design a video-streaming platform with adaptive bitrate, global CDN, and personalized recommendations.
Problem Statement
Design Netflix, a global video-on-demand streaming platform. Users browse a personalized catalog, start playback on many device types, and watch high-quality video with minimal buffering from the nearest healthy edge cache.
At interview scale, assume hundreds of millions of subscribers, tens of millions of simultaneous streams at peak, a catalog measured in petabytes after encoding, and peak egress measured in hundreds of terabits per second. The hard parts are not CRUD APIs; they are offline media processing, pre-positioning popular content into ISP-embedded caches, steering each playback session to the right edge, adapting bitrate in real time, enforcing licensing and DRM, and keeping recommendations and continue-watching fresh.
A strong design separates the cloud control plane from the video data plane. Cloud APIs authenticate users, serve catalog metadata, compute recommendations, authorize playback, and return manifests and edge choices. The video bytes should flow directly from CDN edge caches to the client so the control plane never sits in the hot path for segment delivery.
Business use case
Netflix turns a large licensed content catalog into a personalized, reliable entertainment product. Users expect instant browsing, resume across devices, high quality on fast networks, graceful degradation on slow networks, and correct regional availability.
For the business, the platform must maximize viewing quality and engagement while controlling bandwidth cost. That means encoding every title efficiently, caching demand close to viewers before it peaks, ranking the catalog per member, honoring studio rights, and collecting playback telemetry to improve both recommendations and streaming quality.
Functional Requirements
Let users browse catalog rows, title detail pages, search results, and personalized recommendations.
Start a playback session only when the member, profile, device, region, and title entitlement are valid.
Return a device-appropriate adaptive bitrate manifest, subtitles, audio tracks, and DRM information.
Stream video segments from edge caches with adaptive bitrate switching on the client.
Track viewing history, playback position, completion, thumbs, and continue-watching state across devices.
Ingest studio masters and produce per-title, per-codec, per-device encoding ladders offline.
Pre-position hot titles and new releases onto ISP-embedded edge caches before expected demand.
Collect QoE telemetry such as startup time, rebuffering, bitrate, errors, edge server, and device type.
Non-Functional Requirements
Playback startup latency
The time from pressing play to first frame should be under 2 seconds for healthy broadband connections and under 5 seconds for constrained mobile networks. The control plane should return playback authorization and manifest metadata in a few hundred milliseconds, while segment downloads come from nearby CDN caches.
Availability
Playback should target 99.99 percent availability or better for already-published popular titles. Browse and recommendation features can degrade to cached rows, but active playback must continue even when personalization, analytics, or parts of the catalog management plane are impaired.
Scalability
The system must handle tens of millions of concurrent players, millions of manifest requests per minute, and hundreds of terabits per second of video egress. Scale the control plane horizontally, but scale the data plane through distributed edge caches and ISP peering rather than central cloud bandwidth.
Consistency and freshness
Catalog rights, maturity ratings, and device playback rules must be strongly enforced at session start. Viewing history, recommendations, and popularity signals can be eventually consistent within seconds or minutes because stale rows are annoying but not usually unsafe.
Content durability
Studio masters, mezzanine files, encoded renditions, manifests, subtitle assets, and key metadata are expensive to recreate. Store them in replicated origin storage with versioning, checksums, and disaster recovery. Edge caches may be disposable because they can refill from origin.
Cost efficiency
Bandwidth dominates cost. Use per-title encoding to avoid wasting bits, pre-position popular assets to ISP caches, steer users away from congested or expensive paths, and fetch from cloud origin only on misses or long-tail demand.
Device compatibility
The platform must serve phones, tablets, browsers, smart TVs, set-top boxes, and game consoles. Each device may support different codecs, resolutions, HDR formats, DRM systems, audio layouts, subtitle formats, and buffer behavior.
Capacity Estimation
Assumptions
Assume 300M subscribers, 120M daily active viewers, and 40M peak concurrent streams during prime time and major releases. Average delivered bitrate across mobile, HD, and 4K sessions is 5 Mbps, while high-end 4K sessions can exceed 15 Mbps.
Assume 250K hours of watchable catalog after including movies, episodes, trailers, dubs, and regional variants. If one catalog hour produces about 80 GB across H.264, HEVC, AV1, multiple resolutions, audio tracks, subtitles, thumbnails, manifests, and packaging overhead, the encoded origin catalog is about 20 PB before replication. With three durable copies plus metadata and staging assets, plan for 60 PB or more at origin.
A playback client downloads segments in small chunks, commonly 2 to 6 seconds each. With 40M concurrent streams and one segment request every 4 seconds, the CDN sees about 10M segment requests per second at peak, plus manifest refreshes, subtitle fetches, and telemetry.
Subscribers
300M members
Large global paid service assumption
Daily active viewers
120M viewers per day
About 40 percent of members watch on a busy day
Peak concurrent streams
40M streams
Prime-time global peak and new-release spikes
Average stream bitrate
5 Mbps
Blended across mobile, HD, and 4K sessions
Peak video egress
200 Tbps
40M streams times 5 Mbps before protocol overhead
Segment request rate
10M requests per second
40M players fetching one segment about every 4 seconds
Encoded origin catalog
20 PB raw encoded assets
250K hours times about 80 GB per catalog hour
Replicated origin storage
60 PB plus overhead
Three durable copies, manifests, subtitles, thumbnails, and staging headroom
Hot CDN footprint
5 to 10 PB near users
Pre-position the hottest regional catalog slice across ISP edge caches
Playback telemetry
40M to 80M events per minute at peak
One or two client QoE events per active player per minute
Calculations
- Peak egress: 40M concurrent streams times 5 Mbps is 200M Mbps, which is 200 Tbps before TLS, TCP, and retry overhead. A real platform reserves substantial headroom because major releases and sports-like events create correlated demand.
- Segment requests: if each player fetches a segment every 4 seconds, 40M concurrent players divided by 4 seconds is 10M segment requests per second. This traffic must terminate at CDN edge caches, not at the cloud APIs.
- Catalog storage: 250K catalog hours times 80 GB per encoded hour is 20,000,000 GB, or about 20 PB. Three durable copies make this about 60 PB before indexes, previews, artwork, and temporary encoding outputs.
- CDN footprint: the hottest 20 percent of regional titles may drive 80 percent of streaming. Keeping 5 to 10 PB of hot assets inside ISP edge caches can remove most origin traffic while allowing long-tail titles to fill on demand.
- Telemetry: 40M players sending one to two QoE events per minute means 40M to 80M events per minute, or roughly 667K to 1.33M events per second. This belongs in a streaming pipeline, not a synchronous playback API.
- Control plane load: playback starts are much lower than segment traffic. If 120M daily viewers start three sessions each, that is 360M playback starts per day, or about 4,200 starts per second on average. A 20x peak gives about 84K starts per second, which is large but manageable with stateless APIs and caches.
API Design
/api/v1/profiles/{profileId}/homeReturns personalized home rows, continue-watching titles, trending rows, and editorial collections for a profile. This reads cached ranking output and catalog metadata rather than scoring the entire catalog synchronously.
Response
{
"profileId": "profile_123",
"rows": [
{
"rowId": "continue_watching",
"title": "Continue Watching",
"items": [
{
"titleId": "title_987",
"displayName": "Example Series",
"resumeSeconds": 1840,
"artworkUrl": "https://images.example.net/art/title_987.jpg"
}
]
}
],
"generatedAt": "2026-07-26T07:24:47Z"
}
200— Home rows returned401— Authentication required403— Profile does not belong to the account503— Serve cached fallback rows if personalization is unavailable
/api/v1/titles/{titleId}Returns title detail metadata including synopsis, artwork, episode list, maturity rating, supported audio and subtitle tracks, and whether the title is playable in the viewer's region.
Response
{
"titleId": "title_987",
"name": "Example Series",
"type": "series",
"maturityRating": "TV-14",
"isPlayable": true,
"seasons": [
{
"seasonNumber": 1,
"episodes": [
{ "episodeId": "episode_001", "runtimeSeconds": 3120 }
]
}
],
"audioTracks": ["en-US", "hi-IN"],
"subtitleTracks": ["en-US", "es-ES"]
}
200— Title metadata returned404— Unknown title451— Unavailable due to regional rights
/api/v1/playback/sessionsCreates a playback session. The Playback and Steering API checks subscription state, profile rules, regional rights, device capabilities, DRM support, CDN health, and cache availability before returning a manifest URL and selected edge host.
Request
{
"profileId": "profile_123",
"titleId": "episode_001",
"deviceId": "device_tv_456",
"network": {
"asn": 64500,
"country": "US",
"region": "CA"
},
"capabilities": {
"codecs": ["av1", "hevc", "h264"],
"maxResolution": "4k",
"hdr": true,
"drm": "widevine"
}
}
Response
{
"playbackSessionId": "play_789",
"manifestUrl": "https://edge-17.isp-cache.example.net/manifests/episode_001/av1/master.mpd",
"edgeServerId": "edge-17",
"drmLicenseUrl": "https://api.example.net/api/v1/drm/licenses",
"expiresAt": "2026-07-26T10:24:47Z",
"tracks": {
"audio": ["en-US", "hi-IN"],
"subtitles": ["en-US", "es-ES"]
}
}
201— Playback session created400— Unsupported device capability or malformed request401— Authentication required403— Not entitled to play this title451— Title not licensed in the viewer's region503— No healthy edge available for the requested asset
/api/v1/drm/licensesExchanges a device DRM challenge for a short-lived content key license. The service validates the playback session, device identity, title entitlement, and requested key ids before issuing the license.
Request
{
"playbackSessionId": "play_789",
"deviceId": "device_tv_456",
"drmSystem": "widevine",
"licenseChallenge": "base64-device-challenge"
}
Response
{
"license": "base64-drm-license",
"expiresAt": "2026-07-26T10:24:47Z",
"renewalSeconds": 1800
}
200— License issued401— Authentication required403— Playback session or device is not authorized429— License request rate limited
/api/v1/profiles/{profileId}/history/{titleId}Updates viewing progress and completion state. The write is acknowledged quickly, emitted to the event stream, and later folded into continue-watching, recommendations, and engagement analytics.
Request
{
"playbackSessionId": "play_789",
"positionSeconds": 1840,
"durationSeconds": 3120,
"state": "playing",
"updatedAt": "2026-07-26T07:54:47Z"
}
Response
{
"profileId": "profile_123",
"titleId": "episode_001",
"positionSeconds": 1840,
"continueWatching": true
}
200— Progress stored401— Authentication required403— Profile does not belong to the account409— Older progress update ignored
/api/v1/playback/telemetryReceives batched QoE events from clients. These events drive edge health scoring, ABR tuning, alerting, and recommendation features, but playback must not depend on this endpoint being available.
Request
{
"playbackSessionId": "play_789",
"events": [
{
"type": "rebuffer",
"timestamp": "2026-07-26T07:55:12Z",
"bitrateKbps": 4300,
"bufferSeconds": 1.2,
"edgeServerId": "edge-17"
}
]
}
Response
{
"accepted": true
}
202— Telemetry accepted400— Invalid telemetry batch429— Client should sample or back off
The APIs above are control-plane APIs. They authorize users, shape catalog views, return manifests, issue DRM licenses, and capture state. They should never proxy the actual video segments.
The segment URLs in the manifest point at CDN edge caches. If the control plane is briefly degraded after playback starts, the player should continue downloading already-authorized segments until tokens expire or the manifest needs renewal.
Database Design
Netflix needs several logical stores rather than one monolithic database. Catalog metadata is read-heavy and region-aware. Playback sessions and entitlements require strong checks at session start. Viewing history is write-heavy but compact. Recommendation features and telemetry flow through event and analytical stores.
The serving path should avoid joins. Playback authorization can read a small entitlement and title availability record, then return signed manifest and segment URLs. Video assets themselves live in object storage and CDN caches, not in the metadata database.
| title_id | varchar(64) | Primary identifier for movie, series, season, episode, trailer, or bonus asset |
| parent_title_id | varchar(64) nullable | Series or season hierarchy |
| display_name | varchar(512) | Localized through a separate translations document |
| runtime_seconds | int | Runtime for playable assets |
| maturity_rating | varchar(32) | Used for profile and parental controls |
| available_regions | json | Compact region and license window metadata |
| artwork_refs | json | Pointers to images, previews, and trailers |
| updated_at | timestamp | Used for cache invalidation and search indexing |
| asset_id | varchar(96) | Primary key for a packaged rendition set |
| title_id | varchar(64) | Playable title or episode |
| codec | varchar(32) | H.264, HEVC, AV1, or future codec |
| device_profile | varchar(64) | TV, mobile, browser, game console, or low-power class |
| ladder | json | ABR bitrates, resolutions, segment duration, and quality scores |
| manifest_uri | text | Origin path for DASH or HLS manifest |
| origin_prefix | text | Object storage prefix for segments |
| drm_key_set_id | varchar(96) | Reference to encrypted content keys |
| status | varchar(32) | Encoding, validating, published, deprecated, or withdrawn |
| playback_session_id | varchar(96) | Primary key for a start playback authorization |
| profile_id | varchar(64) | Viewer profile |
| title_id | varchar(64) | Playable asset |
| device_id | varchar(96) | Registered or anonymous device identity |
| edge_server_id | varchar(64) | Selected edge for initial manifest and segment URLs |
| drm_system | varchar(32) | Widevine, PlayReady, FairPlay, or clear for non-premium assets |
| created_at | timestamp | Session creation time |
| expires_at | timestamp | Token and license renewal boundary |
| profile_id | varchar(64) | Partition key for continue-watching reads |
| title_id | varchar(64) | Episode or movie |
| position_seconds | int | Latest known playback position |
| duration_seconds | int | Known duration at update time |
| state | varchar(32) | Playing, paused, completed, removed, or expired |
| last_played_at | timestamp | Sort key for continue watching |
| device_id | varchar(96) | Last device that updated progress |
Indexes
- catalog_titles.title_id is the primary key for detail pages and playback checks.
- catalog_titles.available_regions should be indexed or pre-materialized by region because availability filtering is frequent.
- encoded_assets.title_id, codec, device_profile selects the right ABR ladder at playback start.
- playback_sessions.playback_session_id supports DRM license checks and telemetry correlation.
- viewing_history.profile_id, last_played_at powers continue-watching rows without scanning a profile's full history.
Relationships
A catalog title can have many encoded assets because each title may be packaged for several codecs, devices, bitrates, audio languages, subtitles, and DRM key sets. A playback session references one profile, one playable title, one selected asset family, and one initial edge server. Viewing history is keyed by profile and title so multiple devices converge on one resume position.
NoSQL alternatives
Use document stores or wide-column stores for localized catalog documents, regional availability snapshots, and profile viewing history. Use object storage for encoded media segments. Use a streaming platform for telemetry and watch events. Use an analytical warehouse or feature store for recommendation features and ranking outputs.
For playback session state, a low-latency replicated key-value store is usually better than a relational database because license checks and telemetry correlation are point lookups by session id. The exact product can vary, but the principle is to keep the video-serving data path independent from catalog joins and recommendation scoring.
High-Level Architecture
The control plane runs in cloud services and handles catalog, personalization, entitlement, playback steering, sessions, DRM, and telemetry. The data plane is the heavy path: video segments flow from ISP edge caches to players, with origin storage used for pre-positioning and rare cache misses.
The architecture has two very different traffic profiles. Cloud control-plane services handle relatively small JSON requests for browse, recommendations, session creation, DRM, and history. They need low latency and correctness, but their traffic is tiny compared with the video data plane.
Video bytes should be served from an Open Connect style CDN with appliances embedded in or near ISPs. The offline encoding farm writes packaged renditions to origin storage. A control system predicts demand, pre-positions hot assets onto edge caches, and feeds health and capacity signals to the Playback and Steering API.
During playback, the client mostly talks to the edge cache. It only returns to the control plane for manifest renewal, license renewal, history updates, and telemetry. This protects the cloud APIs from hundreds of terabits per second of video egress and lets the CDN scale independently.
Request Flow
- 1
Content is prepared offline
A studio master arrives as a high-quality mezzanine file. The encoding farm analyzes complexity per scene and per title, chooses codec and device profiles, creates ABR ladders, packages segments and manifests, encrypts assets, validates quality, and writes published renditions to origin storage.
- 2
Popular assets are pre-positioned
Before a launch window or regional peak, the CDN control system pushes likely hot segments, manifests, subtitles, and artwork from origin storage into ISP edge caches. Placement uses regional demand forecasts, catalog availability, edge disk capacity, and historical viewing patterns.
- 3
Home and catalog rows are served
The client requests the home page through the control plane. The Catalog Metadata Service supplies title facts and rights filters, while the Recommendation and History service returns ranked rows and continue-watching state from precomputed outputs and recent profile activity.
- 4
Playback session is authorized
When the user presses play, the Playback and Steering API validates authentication, subscription, profile maturity controls, regional license windows, device capabilities, DRM support, and concurrent stream policy. It creates a short-lived playback session.
- 5
Best edge and ABR ladder are selected
The steering logic chooses an edge server and manifest based on the viewer's ISP, geography, edge health, cache residency, device codec support, measured QoE, and content rights. It returns signed manifest and segment URLs plus DRM license information.
- 6
DRM license is acquired
The player sends a device challenge to the DRM License Service. The service checks the playback session and entitlement, then issues a short-lived license for the encrypted content keys needed by that title, device, and DRM system.
- 7
Segments stream from the edge data plane
The client downloads small video segments directly from the selected edge cache. On a cache hit, bytes come from the ISP appliance. On a miss, the edge fills from origin or an upstream cache, then serves the segment and keeps it according to cache policy.
- 8
Client adapts bitrate continuously
The player measures throughput, buffer depth, dropped frames, viewport, device limits, and recent errors. It switches up or down the ABR ladder every few segments to maximize quality while avoiding rebuffering. The server does not push a fixed bitrate.
- 9
History and telemetry feed learning loops
The client periodically sends progress and QoE events. Viewing history updates continue-watching quickly, while event streams feed recommendation features, edge health scoring, encoding quality analysis, and operational alerting.
Core Components
Client Player
Runs playback, buffering, DRM integration, and ABR decisions on each device.
The player parses manifests, downloads segments, estimates network throughput, manages buffer targets, switches bitrate, decodes video, reports QoE telemetry, and handles license renewal. It must work across TVs, phones, browsers, consoles, and low-power devices with different codec and DRM support.
Playback and Steering API
Authorizes playback and selects the best manifest and edge cache.
This stateless service sits in the control plane. It checks account state, profile rules, regional rights, device capabilities, DRM requirements, CDN cache residency, edge health, and network path quality before returning signed URLs and a playback session.
Offline Encoding Farm
Transforms source media into optimized renditions for many devices.
Encoding workers analyze each title, generate per-title and per-device ABR ladders, create HLS or DASH segments, encrypt outputs, run objective and human quality checks, and publish manifests and segments to origin storage. The farm can be huge but is not in the user-facing playback path.
ISP Edge CDN
Serves the overwhelming majority of video bytes close to viewers.
Edge appliances embedded in ISP networks store popular segments and manifests. They reduce last-mile latency, avoid expensive cloud egress, and absorb peak demand. They should expose health, disk, cache hit ratio, and throughput signals to the steering system.
Catalog Metadata Service
Serves title facts, artwork, hierarchy, ratings, and regional availability.
The catalog service stores localized title documents, license windows, maturity rules, artwork references, cast, genres, search fields, and episode hierarchy. It feeds browse pages, title detail pages, search indexes, playback authorization, and recommendation features.
Recommendation and Ranking Pipeline
Ranks titles and rows for each profile using behavior and content signals.
Batch and streaming jobs build user, title, context, and freshness features. Ranking models produce home rows, similarity lists, trending content, and fallback rows. Online services serve precomputed results with lightweight re-ranking rather than scoring the full catalog per request.
Viewing History Service
Maintains resume position, completion, and watch state across devices.
This service writes frequent progress updates, resolves out-of-order device events, exposes continue-watching rows, and emits durable events for recommendations and analytics. It should be partitioned by profile because reads and writes are profile-centric.
DRM and Entitlement Service
Protects licensed content and issues playback keys only to authorized sessions.
The service verifies playback sessions, devices, subscription state, region, and title rights before returning licenses for Widevine, PlayReady, FairPlay, or similar systems. Keys are short-lived and tied to encrypted renditions and device security levels.
Deep Dive
Control plane versus data plane
The most important architectural split is that cloud APIs decide whether and how a user may play a title, while CDN caches deliver the bytes. The control plane includes authentication, catalog, recommendations, playback session creation, steering, DRM, history, telemetry intake, cache placement decisions, and operational dashboards.
The data plane is the high-bandwidth path from edge cache to player. At 40M concurrent streams and a 5 Mbps blended bitrate, the data plane carries about 200 Tbps. Putting this through application servers would be financially and operationally impossible. Instead, the Playback API returns signed edge URLs and then gets out of the way.
This split also changes failure behavior. If recommendations are down, the client can show cached rows. If telemetry intake is down, playback can continue. If the selected edge is down, steering or the player can fail over to another edge. Only entitlement, DRM, and manifest authorization are truly blocking at start time.
Offline encoding farm and ABR ladders
A naive system would encode every title into the same fixed ladder, such as 240p through 4K at predetermined bitrates. That wastes bandwidth on simple animation and underserves visually complex content. A premium design uses per-title and often per-scene analysis to choose bitrates that hit quality targets for each title.
The farm starts from mezzanine assets, runs complexity analysis, selects codec families such as H.264, HEVC, and AV1, creates ladders for device classes, packages DASH or HLS segments, encrypts content, generates subtitles and audio variants, and validates artifacts. Outputs are immutable versioned assets so cache keys and manifests remain stable.
The tradeoff is storage and compute. More ladders improve quality and device coverage, but they multiply origin storage and cache footprint. The design should keep enough variants for major device and network classes, then rely on ABR switching to adapt within each ladder rather than generating every possible combination.
Pre-positioning content onto ISP edge caches
Open Connect style caching places appliances inside or near ISP networks. Rather than waiting for users to request a new release and stampede origin, the control system predicts demand and pushes likely hot titles to the right regions ahead of time.
Placement uses signals such as release calendar, regional popularity, language, device mix, trending velocity, historical rewatch patterns, marketing campaigns, and available edge disk. Caches keep complete segment ranges for hot titles and partial ranges for medium-demand titles. Long-tail misses are filled from origin or upstream caches.
This reduces latency and cost, but it creates cache allocation tradeoffs. A title may be hot globally but unavailable in some regions due to licensing. A new release may need aggressive prefill even before there is watch history. Cache churn must be controlled so pre-positioning one title does not evict other high-value assets.
Playback steering and edge selection
The steering API should not simply choose the geographically nearest server. It considers ISP, autonomous system, edge health, cache residency, live throughput, packet loss, historical QoE by device class, regional rights, token scope, and failover policy.
At session creation, the API can return a primary edge and backup choices through manifest URLs or DNS-style indirection. If the player sees repeated segment failures or poor throughput, it can request a refreshed manifest or switch to alternate hosts if the manifest permits it.
The key tradeoff is stability versus optimization. Aggressively moving players between edges may improve short-term throughput but can destroy cache locality and cause visible stalls. A good answer uses hysteresis, health thresholds, canaries, and QoE feedback loops rather than per-segment centralized steering.
Adaptive bitrate switching on the client
The server publishes multiple renditions, but the player chooses the next segment. It estimates available bandwidth, buffer depth, decode performance, dropped frames, startup phase, device constraints, and viewport resolution. It starts conservatively to reach first frame quickly, then ramps quality when confidence increases.
ABR algorithms must avoid oscillation. If a player jumps to 4K after one fast segment and then immediately falls back, users see quality shifts and rebuffering. Practical players use smoothed throughput, buffer-based rules, safety margins, and caps from the manifest and device.
Client telemetry closes the loop. Rebuffer rate, startup delay, bitrate distribution, and failed segment requests tell the platform whether an edge is unhealthy, a ladder is too aggressive, or a device profile is wrong. This telemetry should influence future steering and encoding decisions, not block current playback.
Catalog, recommendations, and viewing history
The catalog service answers what can be shown and played: title hierarchy, artwork, metadata, localization, maturity ratings, and regional license windows. The recommendation system answers what should be shown first for a profile and context. These must be connected but separately scalable.
Viewing history is a critical bridge. Resume position powers continue-watching, completion feeds satisfaction features, recent watches affect ranking, and explicit feedback adjusts personalization. Writes are frequent and may arrive out of order from multiple devices, so use version timestamps, idempotent updates, and profile-partitioned storage.
Ranking should be precomputed or nearline for most rows. The online request path can blend cached personalized rows, fresh continue-watching, regional trends, editorial campaigns, and fallback popularity. Scoring the full catalog synchronously for every home request is too slow and too costly.
Licensing, DRM, and regional rights
Streaming rights vary by country, time window, device type, subscription plan, maturity rules, and studio contract. The playback API must enforce these rules before returning a playable manifest. The catalog may hide unavailable titles earlier, but playback authorization remains the source of truth.
DRM protects encrypted content keys. The player obtains a license after proving device capability and referencing an authorized playback session. Licenses should be short-lived, scoped to the title and key ids, and renewable during long sessions. Key material should be isolated from general application services.
The tradeoff is latency and strictness. Overly chatty DRM flows hurt startup time, but weak enforcement risks contract violations. Cache safe entitlement decisions for a short time, sign manifests and segments with bounded expiry, and fail closed for premium content when license validation is uncertain.
Scaling
Prototype: one region and cloud CDN
Start with catalog APIs, simple playback authorization, object storage for encoded assets, a managed CDN, and basic fixed encoding ladders. Recommendations can be editorial or popularity-based, and viewing history can be stored in a relational database keyed by profile and title.
Growth: multi-region control plane and better encoding
Deploy stateless control APIs in several regions, replicate catalog and entitlement data, move history to a profile-partitioned store, add streaming telemetry, and introduce per-title encoding. Use CDN logs and watch events to drive cache prefill decisions.
Global scale: ISP edge caches and steering
Place edge appliances near viewers, pre-position hot assets by region, and build a playback steering service that understands edge health and cache residency. Keep all segment bytes on the CDN data plane and use origin only for long-tail cache fills and publishing.
Mature platform: personalization and QoE feedback loops
Add feature stores, offline and nearline ranking pipelines, contextual re-ranking, A/B experimentation, QoE-based steering, encoding quality optimization, automated cache placement, regional launch playbooks, and strong observability across every playback stage.
Extreme peak: global releases and correlated demand
For a major title launch, prefill caches ahead of release, reserve egress headroom, freeze risky deployments, canary manifests and DRM rules, monitor startup and rebuffer metrics by ISP, and prepare fallback rows and alternate edges. The system should survive demand that rises within minutes rather than hours.
Bottlenecks & Optimizations
Origin storage overload from cache misses
Prefill hot assets into edge caches, use regional mid-tier caches, protect origin with request coalescing, and avoid cache churn before launches. Cache misses should be rare for popular titles and acceptable for long-tail assets.
Inefficient encoding wastes bandwidth
Use per-title and per-scene ladder selection, codec-aware quality metrics, device-specific profiles, and continuous analysis of QoE telemetry. Reducing the average delivered bitrate from 6 Mbps to 5 Mbps at 40M peak streams saves about 40 Tbps of egress.
Playback steering chooses unhealthy edges
Feed real-time edge health, cache hit ratio, ISP path quality, and client QoE into steering. Use canaries, hysteresis, backup hosts, and fast withdrawal of bad edges from manifests and DNS responses.
Recommendation scoring is too expensive online
Precompute candidate sets and row rankings offline or nearline. The online service should fetch cached rows, blend fresh continue-watching and trends, and apply lightweight re-ranking instead of scoring the full catalog per request.
Viewing history receives out-of-order updates
Make progress writes idempotent, include event timestamps and playback session ids, reject older offsets when appropriate, and use merge rules for completion versus resume state. Keep profile-level history reads fast for continue-watching.
DRM license service becomes a startup bottleneck
Scale license issuance horizontally, keep entitlement checks as point lookups, cache safe session validations briefly, rate-limit abusive devices, and support license renewal without forcing full playback reauthorization.
Failure Handling
Selected edge cache fails during playback
The player retries idempotent segment requests, then switches to backup hosts or requests a refreshed manifest. Steering removes the unhealthy edge, while cache control avoids sending new sessions there until health recovers.
Cloud control plane is partially unavailable
Existing playback should continue using already issued signed URLs and licenses until expiry. Browse can serve cached catalog and fallback rows. New playback starts may fail closed if entitlement cannot be verified, especially for premium or region-restricted titles.
Encoding job produces bad renditions
Validate renditions before publishing, keep versioned manifests, run canary playback on representative devices, and roll back manifest pointers to the previous known-good asset set. Do not mutate existing cache keys in place.
Origin region or object store outage
Serve hot content from existing edge caches and replicated origin buckets. Freeze cache evictions for high-demand assets if possible, reroute miss fills to a healthy origin, and degrade long-tail titles before disrupting popular cached playback.
Recommendation pipeline lags
Show cached personalized rows, regional trending rows, editorial collections, and continue-watching from the history store. Mark ranking output freshness internally but do not block browse or playback on model freshness.
DRM or entitlement provider degrades
Use short-lived cached session validations only when policy allows, prioritize license renewals for active playback, shed suspicious or high-rate devices, and fail closed for new sessions when rights cannot be established.
Security
DRM and key isolation
Encrypt premium content and keep content keys in isolated key services. Licenses should be scoped to device, title, key ids, playback session, and expiry. Application logs must never contain raw keys or licenses.
Signed manifests and segment URLs
Manifest and segment URLs should carry short-lived tokens or signatures tied to the playback session, asset, region, and device class. This reduces hotlinking and makes leaked URLs expire quickly.
Regional rights enforcement
Catalog display, playback authorization, DRM licensing, and cache placement must all respect licensing windows. A title should not be pre-positioned or served from a region where it is not licensed.
Account and profile protection
Protect profile changes, parental controls, stream limits, and device registration with authentication, device trust, risk scoring, and rate limits. Playback APIs should not reveal another profile's history or recommendations.
Telemetry privacy
Viewing history and QoE telemetry are sensitive. Minimize raw identifiers, apply retention windows, separate analytics access from serving access, and honor regional privacy requirements for profile data and watch behavior.
Abuse and credential sharing controls
Detect abnormal concurrent streams, impossible travel, automated license scraping, and token replay. Use risk-based challenges and device limits without creating false positives that interrupt legitimate household viewing.
Tradeoffs
Pros
- +Separating control plane from data plane keeps cloud APIs out of the high-bandwidth segment path.
- +Per-title encoding improves quality per bit and reduces CDN egress cost.
- +ISP-embedded edge caches reduce latency, origin load, and transit cost for popular titles.
- +Precomputed recommendations and continue-watching keep browse latency low while still personalizing the experience.
- +Client-side ABR adapts to real network and device conditions without central coordination.
Cons
- −Offline encoding and cache pre-positioning add operational complexity before a title can be published.
- −Many device, codec, DRM, audio, and subtitle variants multiply testing and storage footprint.
- −Edge placement decisions can be wrong, causing cache misses or evicting valuable regional content.
- −Strict DRM and licensing checks can increase startup latency and create hard failure modes.
- −Personalization depends on sensitive viewing data and requires strong privacy controls.
Alternatives
Alternative one is to rely entirely on a third-party CDN. This is faster to launch and simpler operationally, but it gives less control over ISP placement, cache prefill, cost, and playback telemetry feedback.
Alternative two is to stream through application servers. This is acceptable only for a prototype or tiny catalog because application servers would become the video data plane and collapse under terabits of egress.
Alternative three is to use one fixed encoding ladder for all titles and devices. It reduces encoding complexity but wastes bandwidth on easy-to-encode titles and lowers quality for complex titles.
When not to use this design
Do not build this full architecture for a small internal training video portal, a low-traffic course site, or an app with a tiny catalog. Use object storage, a managed CDN, simple encoding presets, and basic access tokens until bandwidth, device diversity, rights complexity, and personalization justify the added machinery.
Follow-up Questions
Why not serve video through the Playback API?
The Playback API handles authorization and steering, but segment egress is hundreds of terabits per second at peak. Serving bytes through application servers would be too expensive and fragile. The API should return signed URLs, while edge caches deliver segments directly to clients.
How does the system choose which edge server a client should use?
Use ISP and geography, edge health, cache residency, observed throughput, packet loss, device class, title rights, and recent QoE telemetry. The nearest edge is not always best if it is congested, missing the asset, or on a poor network path.
What makes per-title encoding better than a fixed ladder?
Different titles need different bitrates for the same perceived quality. Animation, dark scenes, grain, and fast motion behave differently. Per-title encoding spends bits where they improve quality and saves bandwidth where simpler content can look good at lower bitrates.
How should continue-watching handle updates from two devices?
Progress updates should include timestamps, playback session ids, and positions. The history service applies deterministic merge rules, ignores stale events, preserves completed state when appropriate, and exposes the latest resume position by profile and title.
What happens if a title is not cached at the selected edge?
For long-tail content, the edge can fill from origin or an upstream cache. For popular content, repeated misses indicate bad pre-positioning or steering. The system should coalesce fills, monitor miss rate, and adjust placement before origin becomes overloaded.
Where do recommendations run: online or offline?
Most expensive candidate generation and ranking should run offline or nearline. The online service fetches cached rows, blends fresh continue-watching and regional trends, and does lightweight re-ranking. Full catalog scoring on every request is too slow.
How do DRM and signed URLs work together?
Signed URLs limit who can fetch encrypted segments and for how long. DRM licenses give authorized devices the keys needed to decrypt those segments. Both are needed: signed URLs reduce theft and hotlinking, while DRM protects the content after bytes reach the device.
Company Variations
Netflix
Netflix interviewers expect depth on Open Connect style edge caching, per-title encoding, playback QoE, ABR behavior, catalog rights, and personalization. Be explicit that cloud APIs are the control plane and edge caches are the data plane.
Amazon
Amazon may frame this around Prime Video scale, AWS services, multi-region resiliency, cost, object storage, CDN economics, and operational ownership. Expect follow-ups on origin protection, rights enforcement, and how to keep the control plane available during large releases.
Google often probes global serving, YouTube-like video infrastructure, ranking quality, client adaptation, storage efficiency, and tail latency. Be ready to discuss codec choices, cache hierarchy, feature pipelines, and data-driven QoE optimization.
Interview Tips
Lead with the core insight: Netflix is a video data-plane problem wrapped by a rich control plane. Draw the path from client to edge cache for segments, then add the cloud services that authorize and personalize that path. Make the offline encoding and cache pre-positioning story explicit before diving into recommendations or databases. Use concrete numbers to show why the CDN design is necessary.
What interviewers expect
- ✓Start with playback and egress scale, then draw the control and data plane split.
- ✓Explain the offline media pipeline before the live playback request path.
- ✓Use edge caches, origin storage, steering, DRM, catalog, recommendations, and history as separate concerns.
- ✓Give realistic math for subscribers, concurrent streams, petabytes of catalog, and terabits of egress.
- ✓Discuss tradeoffs among quality, startup time, cache footprint, rights enforcement, and cost.
Common mistakes
- !Routing video bytes through API servers instead of CDN edge caches.
- !Ignoring offline encoding, per-title ladders, and device compatibility.
- !Treating recommendations as a simple database query instead of a ranking pipeline.
- !Forgetting licensing, regional rights, DRM, and signed segment URLs.
- !Not giving concrete capacity numbers for egress, segment requests, and catalog storage.
Red flags
- ×No separation between control plane and data plane.
- ×No explanation of how the player switches bitrate or recovers from poor networks.
- ×No cache pre-positioning or origin protection strategy for new releases.
- ×No plan for continue-watching consistency across devices.
- ×No privacy or security treatment for viewing history and DRM keys.
Revision Notes
- Design around two planes: control plane APIs in cloud, video data plane from CDN edge caches to clients.
- At 40M concurrent streams and 5 Mbps average delivered bitrate, peak egress is about 200 Tbps.
- If players fetch 4-second segments, 40M active streams generate about 10M segment requests per second.
- A 250K-hour catalog at 80 GB per encoded hour is about 20 PB before replication and about 60 PB with three durable copies.
- Offline encoding creates per-title, per-device ABR ladders for codecs, resolutions, audio, subtitles, packaging, and DRM.
- ISP-embedded edge caches should be prefilled with regionally hot assets before demand arrives.
- Playback steering chooses an edge using health, ISP, cache residency, rights, device capabilities, and QoE telemetry.
- The client performs adaptive bitrate switching based on bandwidth, buffer, decode performance, and errors.
- Catalog metadata controls what can be shown and played; recommendations decide what should be ranked first.
- Viewing history powers continue-watching and personalization, but it can be eventually consistent with deterministic merge rules.
- DRM licenses and signed URLs protect content and enforce regional and device entitlements.
Flashcards
Quiz
0/6 answered
1.Why should Netflix not proxy video segments through the Playback API?
2.What is the main purpose of per-title encoding?
3.Given 40M concurrent streams at 5 Mbps each, what is the approximate peak video egress?
4.Which component should make adaptive bitrate decisions during playback?
5.What is the best way to serve continue-watching quickly?
6.Why pre-position a new season before release time?
Cheat Sheet
Goal: stream licensed VOD content globally with fast startup, low buffering, high quality, correct rights enforcement, and personalized discovery.
Scale: 300M subscribers, 120M daily active viewers, 40M peak concurrent streams, about 200 Tbps peak egress, and about 10M segment requests per second with 4-second segments.
Storage: 250K catalog hours times about 80 GB per encoded hour is about 20 PB of encoded origin assets. With three durable copies, plan for 60 PB plus metadata, artwork, subtitles, and staging outputs.
Offline pipeline: ingest mezzanine files, analyze content complexity, generate per-title and per-device ABR ladders, package HLS or DASH, encrypt, validate, and publish immutable assets to origin storage.
CDN: pre-position hot regional assets into ISP-embedded edge caches. Edge caches serve segment bytes; origin handles publishing, prefill, and long-tail misses.
Playback start: client calls the Playback and Steering API. The API checks subscription, profile, region, device, rights, DRM, edge health, and cache availability, then returns signed manifest and segment URLs.
ABR: client chooses the next rendition based on throughput, buffer, device decode ability, viewport, dropped frames, and recent errors.
Catalog and personalization: catalog determines what can be shown and played; ranking decides ordering. Viewing history powers continue-watching and feeds recommendation features.
Security: enforce regional rights, signed URLs, DRM licenses, key isolation, parental controls, stream limits, privacy controls, and abuse detection.
Reliability: existing playback should survive partial control-plane outages. Edge failures require retry, alternate hosts, manifest refresh, and fast steering withdrawal.
References
- DocsOpen Connect — Netflix
- BlogPer-Title Encode Optimization — Netflix Technology Blog
- BlogDynamic Optimizer - A Perceptual Video Encoding Optimization Framework — Netflix Technology Blog
- BookDesigning Data-Intensive Applications — Martin Kleppmann