All problems

Live Streaming

Twitch-style live video — one big streamer, a whole city watching.

hard~24 min Pro Simulator · +140 ptsTheory +42 pts
The build

Keep segments flowing to every viewer when a star streamer goes live, a packager dies, and the edge loses the origin.

Live video lives or dies at the edge — the CDN has to absorb the overwhelming majority of segment fetches, because origin capacity can never match a stampede 1:1. What leaks past the edge splits into two very different jobs: serving cached segments to viewers (the huge majority) and transcoding freshly-ingested segments (a small, steady trickle) — both landing in the same object store.

Components in play

  • Edge CDNServes segments for hot streams straight from the edge — the whole game.
  • Origin gatewayFields the CDN's misses and routes viewer fetches vs. ingest uploads.
  • PackagersServes the current segment set to viewers on a CDN miss.
  • Origin segment cacheShields the object store from repeated origin-level segment requests.
  • Segment storeDurable home for every encoded video segment.
  • Ingest queueAbsorbs freshly-uploaded raw segments from the streamer's encoder.
  • TranscodersTranscode raw segments into every playback bitrate before they land in storage.

Graded on these SLOs

  • ≥ 96.00%Segments served
  • ≤ 150 msSegment fetch p99
  • ≥ 16k rpsSustain the stampede
  • ≤ 90%Headroom
  • ≤ 12Lean footprint
Base 16,000 rps46s run 4 scripted failures

The brief

Design the delivery backend for a Twitch-style live video platform. A streamer's raw feed is ingested and transcoded into segments; viewers fetch those segments continuously to keep playing. When a big streamer goes live, viewer demand can jump 3x in seconds — and it all has to be absorbed without a rebuffer.

Functional

  • Ingest a streamer's raw segments and transcode them to every playback bitrate
  • Serve the current segment set to any number of concurrent viewers
  • Keep every segment durably stored for the life of the stream (and replay/VOD after)

Non-functional

  • A viewer stampede can be an order of magnitude bigger than steady-state, in seconds
  • Segment fetches are latency-sensitive — a slow fetch is a visible rebuffer
  • Ingest (encoder → transcode) must never compete with viewer egress capacity

Warm-up: design decisions

Optional theory to prime the calls a senior engineer would make before you build.

Pro

Solving is a Pro feature

Unlock the on-canvas AI design coach, per-run design reviews, the chaos simulator and all 12 problems for $15/month.

  • AI design coach on your canvas — pins failure points & over-engineering
  • Honest AI design review on every run
  • All 12 problems + unlimited chaos simulator
  • Points, levels & leaderboard
Get started