Case study demo

Video streaming

Follow a video from upload through transcoding to adaptive streaming from a CDN.

An interactive demo of how this system behaves. It runs in your browser.

Case study · Live model

How video streaming behaves

A video is uploaded once. Workers called transcoders turn it into three qualities, and the origin stores them. Viewers get it in 1-second segments from CDN edges near them. Upload ten at once, slow the network, or turn the CDN off, and watch who waits.

Try it

Lab time 3.0 s
storeplayon a missUploader, sends a video fileUploadersends a video file1 uploads so farUpload service, stores it, makes jobsUpload servicestores it, makes jobs3 jobs a videoRaw video store, the original fileRaw video storethe original filestored onceTranscode queue, 0 jobs waitingTranscode queue0 jobs waitingone video at a timeTranscoders, 0 of 2 busyTranscoders0 of 2 busy360p, 720p, 1080pOrigin (video store), 8 of 40 a secondOrigin (video store)8 of 40 a second0 refusedViewers, 30 watchingViewers30 watching1080p at 8 MbpsCDN edges, 47% answered hereCDN edges47% answered here48 segments kept
  • Uploader — sends a video file — healthy — 1 uploads so far
  • Upload service — stores it, makes jobs — healthy — 3 jobs a video
  • Raw video store — the original file — healthy — stored once
  • Transcode queue — 0 jobs waiting — healthy — one video at a time
  • Transcoders — 0 of 2 busy — healthy — 360p, 720p, 1080p
  • Origin (video store) — 8 of 40 a second — healthy — 0 refused
  • Viewers — 30 watching — healthy — 1080p at 8 Mbps
  • CDN edges — 47% answered here — healthy — 48 segments kept
  • An upload, or a viewer asking for a segment
  • A file or a quality being stored
  • A transcode job
  • An edge fetching from the origin
Can be watched
1/ 1 uploads
1 have every quality
Longest first wait
0.5 s
newest 10 uploads: from upload to a first quality
Answered at an edge
47%
of requests, last 3 s
Refused by the origin
0
it serves 40 segments a second
Time spent waiting
0%
of viewers' time, last 3 s
Quality playing
1080p
the best the network can carry

Numbers add up:3 jobs = 3 done + 0 waiting + 0 in progress · 90 segment requests = 42 answered at an edge + 48 by the origin + 0 refusedThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

Uploads
0.2 a second
Which job comes next

Finish every quality of the oldest upload before starting the next upload.

2
Viewers
30

Each viewer asks for one 1-second segment every second.

Edges near the viewers keep the segments they have fetched and answer later requests themselves.

Play the best quality the network can carry. Off: always 1080p.

8 Mbps

Mbps is megabits of data a second. 360p needs 1 Mbps; 720p needs 3 Mbps; 1080p needs 6 Mbps.

Newest uploads

VideoQualities readyCould first be watched after
Video 43 of 30.5 s
Transcode jobs waiting
00.511.521s2s3s
Show data table
TimeJobs waiting
1s1
1s0
2s0
2s0
3s0
3s0
Origin load (segments a second) and viewers' waiting time (%)
Origin loadWaiting time %Origin limit
012.52537.5501s2s3s
Show data table
TimeOrigin loadWaiting time %
1s100
1s230
2s220
2s150
3s80
3s80

What just happened

  1. 0.8sInfo: Video 4 can be watched in 360p, 0.5 s after its upload.
What this model simplifies
  • Three qualities, which take 0.5 s, 1 s and 2 s to make. Real services make many more, and a long video takes minutes on many machines at once.
  • Viewers watch the newest 3 videos, 20 segments each. Real viewing is spread over millions of videos, and most of them are watched rarely.
  • Every viewer has the same network speed. Real players measure their own speed every few seconds and change quality as it moves.
  • A slow network is shown as waiting time. A real player keeps a buffer of some seconds, so a short dip does not freeze the picture.
  • The origin serves 40 segments a second and refuses the rest at once. A real origin slows down first.
  • An edge keeps a segment for 30 s after it fetched it, and there is one edge. Real CDNs have many edges, each with its own copy.

Design it

New videos fast, and no stalls for viewers

Viewers watch the newest videos, one 1-second segment at a time. At 5 s, six people upload a video at once, and workers turn each upload into 360p, 720p and 1080p. Pick the workers, their order, a CDN and adaptive quality, then check the design.

The goals

  • Each of the six new videos can be watched within 3 s of its upload.
  • With 60 viewers, video stalls for at most 1% of watch time.
  • On a 3 Mbps link, video stalls for at most 1% of watch time.
Transcoding workers
Work order
CDN edges in front of the store
Adaptive quality

The check runs the same engine as the demo on this page for 30 simulated seconds under each condition, with a fixed seed, so a design always gets the same result. There is no score: each goal passes or fails.