Design of YouTube
Define the high-level and detailed System Design for YouTube, outlining the data flow from video ingestion to content delivery via CDNs. Explore the necessary REST API design and component integration, including specialized storage solutions like Bigtable for massive scalability.
High-level design
The high-level design connects the components identified in the previous lesson. This solution supports the defined functional and non-functional requirements.
The abstract design workflow is as follows:
The user uploads a video to the server.
The server saves metadata and user data to the database and simultaneously sends the video to the encoder.
The encoder and transcoder compress the video and generate multiple resolutions (e.g., 2160p, 1440p, 1080p). Resulting files are stored in blob storage (similar to GFS or S3).
Popular videos are forwarded to the CDN for caching.
The CDN serves the video to the user with low latency. However, CDN is not the only infrastructure for serving videos to the end user, which we will see in the detailed design.
Why don’t we upload the video directly to the encoder instead of to the server? Doesn’t the current strategy introduce an additional delay?
API design
We will use REST APIs to expose the system’s functionality. The client interacts with the backend through the following endpoints:
Upload videos
Stream videos
Search videos
View thumbnails
Like or dislike videos
Comment on videos
Upload video
Use the POST method to upload a video via the /uploadVideo API:
uploadVideo(user_id, video_file, category_id, title, description, tags, default_language, privacy_settings)
The parameters are described below:
Parameter | Description |
| This is the user that is uploading the video. |
| This is the video file that the user wants to upload. |
| This refers to the category a video belongs to. Typical categories can be “Entertainment,” “Engineering,” “Science,” and so on. |
| This is the title of the video. |
| This is the description of the video. |
| This refers to the specific topics the content of the video covers. The |
| This is the default language a page will show to the user when the video is streamed. |
| This refers to the privacy of the video. Generally, videos can be a public asset or private to the uploader. |