FSD Frontend System Design

Part VI β€” The Blueprint Β· Lesson 11.5

HLD – Video Streaming (Netflix)

In one lineAdaptive bitrate keeps the buffer full β€” every other decision serves that one goal.

Where you've seen itVideo quality softening for a few seconds in a tunnel, then recovering, without ever showing a spinner.

  • Time20 min
  • DiagramABR ladder + buffer state machine
  • Chapter11 Β· High Level Design

Diagram

diagram
1–2 Β· SCOPE AND SCALE

  in scope   browse rows Β· title page Β· player Β· continue watching
  out        recommendations ML Β· billing Β· downloads Β· profiles admin
  scale      250M subscribers Β· 4K streams up to 25 Mbps
             TV / laptop / phone Β· network varies mid-playback
diagram
3 Β· ARCHITECTURE

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  manifest (HLS/DASH)  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Player │◄─────────────────────►│  CDN edge   β”‚
  β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  2–10s segments        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                                    β–²
      β”‚ metadata, rows, continue-watching  β”‚ segments pre-positioned
      β–Ό                                    β”‚ at edges worldwide
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚   BFF   │───────►│ catalog Β· playback Β· CDN β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚ auth (DRM licence)       β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
diagram
6a Β· DEEP DIVE β€” THE ABR LADDER

  the same title, encoded many times

  2160p  25 Mbps  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
  1080p   5 Mbps  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
   720p   3 Mbps  β–ˆβ–ˆβ–ˆ
   480p   1 Mbps  β–ˆ
   240p 300 kbps  ▏

  each rendition is cut into 2–10s segments; the manifest lists them

  every segment boundary, the player asks:
    measured throughput + current buffer level
        β”‚
        β”œβ”€ buffer healthy & bandwidth up   β†’ step UP one rung
        β”œβ”€ buffer draining                 β†’ step DOWN immediately
        └─ never jump more than one rung up (avoids oscillation)
diagram
6b Β· DEEP DIVE β€” BUFFER STATE MACHINE

  [empty] ──fill 2s──► [playable] ──fill 30s──► [healthy]
     β–²                      β”‚                       β”‚
     β”‚                      β”‚ drains                β”‚ drains
     β”‚                      β–Ό                       β–Ό
     └────── [rebuffering] ◄── drop bitrate ◄── [low]
              β–² THE thing to avoid: users tolerate
                lower quality far better than a stall

  Startup: request the LOWEST rung first β†’ playback begins in <1s,
           then climb. Starting high looks better and feels worse.

How it works

  1. HLS or DASH manifest lists renditions and segments; the player (hls.js / Shaka via Media Source Extensions) does the switching.
  2. Start low, climb fast β€” time-to-first-frame beats initial sharpness.
  3. Prefer dropping quality over stalling. Rebuffering is the metric that correlates with abandonment.
  4. Preload smartly: the next episode's first segments during the end credits; hover previews at the lowest rung only.
  5. Resume position synced to the server every ~10s and on visibilitychange, so any device continues where you stopped.

Trade-offs

ChoiceCost
Short segments (2s)Faster adaptation, more requests
Long segments (10s)Fewer requests, slower reaction
Large bufferResilient, wastes data if abandoned
Start at lowest rungFast start, first seconds look soft

Cross-cutting: DRM licence acquisition before first frame, captions and audio-description tracks as accessibility requirements (8.1), and player telemetry β€” startup time, rebuffer ratio, average bitrate β€” as the core quality metrics (7.2).

Interview angle

"The video keeps stalling on mobile. What do you change?"

  • Check the buffer policy first: the player should drop a rung on a draining buffer rather than defending quality.
  • Shorten segment length so adaptation reacts faster, and cap the maximum rung on small screens where 4K is invisible anyway.
  • Verify with rebuffer ratio in telemetry, not by watching it once on a good connection.

Recap

  • Keep the buffer full; quality is the variable you trade to do it.
  • Start at the lowest rung for a sub-second first frame, then climb.
  • Rebuffer ratio, not resolution, is the metric users actually feel.