SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 07
Design a video upload and streaming service
Creators upload videos from phones and laptops, often on shaky connections. Viewers press play on a phone on a train, a laptop on office wifi, or a living-room TV, and expect the picture to start almost immediately and keep going without a spinner even when their bandwidth changes.
Requirements
- A creator can upload a video file up to 4 hours long and see its processing status.
- Each upload is converted into formats and quality levels that phones, browsers and TVs can play.
- A viewer can start playback and the quality adapts to their current bandwidth without stopping.
- Each video has a watch page with title, description, thumbnail, duration and creator.
Constraints and assumptions
- 500,000 uploads a day, averaging 10 minutes and about 800 MB per source file.
- 200 million plays a day; at the evening peak about 10 million streams run at once, averaging 4 Mbps.
- Popularity is very skewed: about 5% of videos account for 80% of watch time.
- Playback should start within 2 seconds at p90; a 10-minute upload should be watchable within 15 minutes.
- Uploaded videos are never lost once the creator sees "upload complete".
Out of scope for the first sketch
Recommendations and search · Comments, likes and subscriptions · Live streaming · DRM license servers and ads
Draw your design
Rough math and notes
SYSTEM DESIGN SKETCHBOOK / FOLLOW-UPS
Design a video upload and streaming service
Finish your first sketch before answering these. Cross out freely.
- A creator's 3 GB upload drops at 90% on a mobile connection. What does your upload path do when they reconnect?
- A viewer's bandwidth falls from 8 Mbps to 1.5 Mbps halfway through a video. Which component notices, and what changes?
- A huge creator publishes a new video and 2 million people press play in the first ten minutes. Where does that load land?
- Most of the catalog is almost never watched, but you store every quality level for every video. How would you cut that cost without hurting popular videos?
Compare afterwards: worked approaches and reading at sketchbook /questions/video-streaming/review