Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 07

Design a video upload and streaming service

Intermediate · 40 min · Caching & read paths

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

Done on paper? Compare with the worked approaches