Design a video streaming service like YouTube
HardConceptMedia & Commerce
Answer
Requirements: upload videos, play them smoothly on any device and network, and support search, view counts and comments at a very high read-to-write ratio.
- Upload and processing: raw files go to object storage; a queue-driven transcoding pipeline converts each video into several resolutions and codecs and splits it into segments a few seconds long.
- Playback: clients use adaptive bitrate streaming (HLS or DASH), fetching a manifest and switching quality segment by segment as bandwidth changes.
- Delivery: segments are served from a CDN; metadata such as titles, owners and view counts lives in a database with caching.
- Trade-off: storing many renditions and serving everything from the CDN is expensive, so popular videos are cached at the edge while rarely watched ones may be served from origin or kept in fewer formats.
More in Media & Commerce
| # | Problem | Platform | Difficulty | Open | 1st1st Visit | 2nd2nd Visit | RevRevise |
|---|---|---|---|---|---|---|---|
| 1 | Design a video streaming service like YouTube | Concept | Hard | Read the answer to Design a video streaming service like YouTube | |||
| 2 | Design a ride-hailing service like Uber | Concept | Hard | Read the answer to Design a ride-hailing service like Uber | |||
| 3 | Design an e-commerce checkout system | Concept | Hard | Read the answer to Design an e-commerce checkout system | |||
| 4 | Design a distributed file storage service like Dropbox or Google Drive | Concept | Hard | Read the answer to Design a distributed file storage service like Dropbox or Google Drive |