Design Youtube / Netflix

Problem Statement:


Step-1: Why Youtube?


Step-2: Requirements and Goals of the System


Step-3: Capacity Estimation and Constraints

Traffic Estimates:
Storage Estimates:
Bandwidth estimates:


Step-4: System APIs

Upload Video API
uploadVideo(api_dev_key, video_title, vide_description, tags[], category_id, default_language, recording_details, video_contents)
Search Video API
searchVideo(api_dev_key, search_query, user_location, maximum_videos_to_return, page_token)


Step-5: High Level Design

At a high-level we would need following components:

  1. Processing Queue: Each uploaded video will be pushed to a processing queue, to be de-queued later for encoding, thumbnail generation, and storage.
  2. Encoder: To encode each uploaded video into multiple formats.
  3. Thumbnails generator: We need to have a few thumbnails for each video.
  4. Video and Thumbnail storage: We need to store video and thumbnail files in some distributed file storage.
  5. User Database: We would need some database to store user’s information, e.g., name, email, address, etc.
  6. Video metadata storage: Metadata database will store all the information about videos like title, file path in the system, uploading user, total views, likes, dislikes, etc. Also, it will be used to store all the video comments.


Step-6: Database Schema

Video metadata storage - MySql
User data storage - MySql


Step-7: Detailed Component Design

Where would videos be stored ?
How should we efficiently manage read traffic?
Where would thumbnails be stored ?
Video Uploads:
Video Encoding:


Step-8: Metadata Sharding

Sharding based on UserID Hash:
Sharding based on VideoID hash:


Step-9: Video Deduplication


Step-10: Load Balancing


Step-11: Cache


Step-12: Content Delivery Network (CDN)


Step-13: Fault Tolerance




← Previous: Design Twitter

Next: Design Type Ahead Suggestion →