Design a video platform where creators upload recorded videos and viewers watch them on phones, laptops and TVs. Creators upload 50,000 videos a day, up to 4 GB each. At peak, 2 million people watch at once; players fetch a few-second video segment roughly every 4 seconds and switch quality as their bandwidth changes. Playback must start quickly and rarely stall, and a new upload should be watchable within 15 minutes.
Functional requirements
Upload large video files with resumable uploads
Transcode each upload into several resolutions and bitrates
Stream video with adaptive bitrate so quality follows the viewer's bandwidth
Browse video pages with title, description, thumbnail and view count
Resume playback where the viewer stopped
Non-functional requirements
Playback starts within 2 seconds at p95
Fewer than 1% of sessions stall for rebuffering
A new upload is playable within 15 minutes
Uploaded originals are never lost
Constraints and scale
2 million concurrent viewers at peak, about 500,000 segment requests per second
50,000 uploads a day, average 600 MB, up to 4 GB
Each video is stored in 5 renditions, roughly 3x the size of the original
You will practise
Serve segmented video from a CDN with adaptive bitrate streaming (HLS or DASH)
Run transcoding as a parallel, retryable background pipeline
Keep the metadata API small and fast, separate from the heavy video bytes
Show 3 hints
Half a million segment requests per second should not reach your servers. Who serves them instead?
A 2-hour video takes a long time to transcode on one machine. Can it be split into chunks?
Most views go to a small fraction of videos; how does that help your caching and storage costs?