FREE · TOPIC 071

Adaptive Bitrate And CDN Decider

499 words·Updated 2026-07-18·
#system-design#video-systems#cdn#performance
# Adaptive Bitrate And CDN Decider Adaptive bitrate streaming lets the player switch between video variants based on network, device, and buffer conditions. A CDN decider decides which variants are worth precomputing and caching. ## Adaptive Bitrate The player downloads a manifest that lists variants: ```text 240p low bitrate 480p medium bitrate 720p high bitrate 1080p higher bitrate ``` As conditions change, the player switches. ```mermaid flowchart LR Net[network/buffer/device state] --> Player[player] Player -->|slow| Low[lower bitrate segment] Player -->|fast| High[higher bitrate segment] ``` HLS is one common packaging format: playlists reference ordered media segments, and master playlists reference variant playlists. ## Eager vs Lazy Transcoding Eager: - generate all variants at upload time, - good playback readiness, - expensive for long-tail videos nobody watches. Lazy/on-demand: - generate baseline variant first, - generate higher variants on first demand or popularity threshold, - cheaper for long-tail content, - first request may pay delay. ## CDN Decider Inputs: - channel popularity, - current view velocity, - geography of viewers, - content type, - recent shares, - trending service signal, - expected event/live spike. Outputs: - transcode more variants, - push/warm CDN, - keep at origin, - evict from CDN, - use cheaper storage tier. ## Decision Matrix | Signal | Likely Decision | |---|---| | new upload, no viewers | baseline variant only; no prewarm | | high subscriber channel | generate common variants eagerly | | sudden view velocity | prewarm top regions and protect origin | | regional spike | push only to affected CDN geography | | old long-tail video | keep manifest; move segments to colder storage | | repeated `variant.missing` events | generate that rendition and update manifest | The decider should be conservative with expensive actions. A false positive wastes transcoding and CDN storage; a false negative creates a slower first playback. ## Player Contract The manifest is part of the product contract. The player must know how to react when: - only the baseline rendition exists, - a higher rendition appears during playback, - a segment returns 404 from CDN but exists at origin, - a CDN region is unhealthy, - the viewer is on a metered or low-power device. Prefer fallback behavior over hard failure. For example, retry a missing 1080p segment at 720p before surfacing an error. ## Operational Notes Track CDN hit ratio by variant, origin shield traffic, manifest error rate, startup delay, rebuffering time, bitrate switches, and first-play delay for lazy variants. These metrics connect economic decisions to playback quality. Guardrails matter. The decider should have caps such as maximum new transcodes per hour, maximum prewarm bytes per region, and manual override for live events or launches. ## Cost Insight At scale, "cache everything" is not a plan. CDN storage and egress cost money. Transcoding every obscure upload to every format burns compute. The decider is the economic control loop. ## Related Events - `video.published` - `video.viewed` - `video.trending` - `cdn.cache_requested` - `variant.missing` - `variant.generated` These are good candidates for [[wiki/event-bus-for-product-events]].
Primary References & Engineering Sources