We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
4 system design questions lean on this idea. Each walks through the full answer.
System Design Masterclass · Web Content Delivery
Free preview: the first 2 parts of this 7-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Web Content Delivery
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
Imagine watching a live concert on your phone. You start on wifi in the living room: crisp 1080p. You walk to the kitchen, further from the router: drops. You step outside to check the mail: cellular kicks in at 5 Mbps. Then you walk past a dead zone: bandwidth drops to 500 Kbps for 10 seconds.
With a fixed bitrate stream, any bandwidth drop below the video's bitrate causes buffering. The player stalls, shows a spinner, and waits for enough data to resume. Users hate buffering more than they hate low resolution. A Conviva study found that a single buffering event increases the probability of the viewer abandoning the stream by 39%.
Adaptive bitrate (ABR) streaming solves this by encoding the video at multiple quality levels and letting the player switch between them in real time. When bandwidth is high, the player fetches 1080p segments. When bandwidth drops, the next segment is 480p. The switch happens at segment boundaries (every 2-6 seconds), so the visual quality changes smoothly without any buffering.
Netflix reports that ABR reduced buffering events by over 90% compared to fixed-bitrate delivery. YouTube's ABR algorithm handles billions of quality switches per day across every network condition on earth.
Three families of ABR algorithms exist, and every production player uses one of them or a hybrid.
-based. Measure how fast the last N segments downloaded. Pick the highest bitrate that fits within the measured . Simple, reactive, but unstable: if bandwidth fluctuates between 3 Mbps and 5 Mbps, the player oscillates between 720p and 1080p every few segments. The visual effect is annoying. Dash.js's default algorithm is throughput-based.
Buffer-based (BBA). Ignore throughput measurements. Instead, look at how full the playback buffer is. If the buffer has 30 seconds of video, you have plenty of runway, so fetch the highest bitrate. If the buffer is under 10 seconds, play it safe with a lower bitrate. Stanford's BBA paper (2014) showed this approach is more stable than throughput-based because it reacts to the effect (buffer drain) rather than the cause (bandwidth change). The player never needs to directly estimate bandwidth, which is notoriously noisy.
Hybrid (MPC, Pensieve). Use both throughput estimates and buffer level, plus a cost function that penalizes quality switches and rebuffering. MPC (Model Predictive Control) solves an optimization problem over the next 5-10 segments: maximize quality, minimize switches, avoid rebuffering. Facebook's Pensieve (2017) used reinforcement learning to train an ABR agent on millions of real network traces. It outperformed all hand-tuned algorithms by 10-25% on the QoE metric.