Copy-Design
High-level design
Interviewer: How do you think the components are related to each other.
Candidate: The high-level design shows how the various components will be interconnected to support the functional and non-functional requirements.
Interviewer: How does this work?
Candidate: The workflow for the abstract design is provided below:
- The user uploads a video to the server.
- The server stores the metadata and the accompanying user data to the database and, at the same time, hands over the video to the encoder for encoding.
- The encoder along with the transcoder, compresses the video and transforms it into multiple qualities (like 2160p, 1440p, 1080p, etc.) for streaming.
- The videos are stored on the server’s file system (similar to GFS or S3) as well as forwarded to the CDN.
- The CDN, because of its vicinity to the user, lets the user stream the video with low latency. However, CDN is not the only infrastructure for serving videos to the end-user. Let me get back to that in the detailed design.
Interview cross-question
Interviewer: Why don’t we upload the video directly to the Encoder instead of the server? Isn’t the current strategy introducing an additional delay?
API design
Interviewer: That’s a start. At this point, it will be a good idea to know the design of functionality in the form of an API outline.
Candidate: Sure, a good idea to start designing APIs is to translate our feature set into technical specifications. In this case, the REST APIs can be used for simplicity and speed purposes. Our API design section will help us understand how the client will request services from the backend application of Youtube. Let’s develop APIs for each of the following features:
- Upload video
- Stream video
- Search video
- Comment video
- Like/dislike video
Upload video
The POST method can upload a video to the /uploadVideo
API:
uploadVideo(user_id, video_file, category_id, title, description, tags, default_language, privacy_settings)
I would like to explain the parameters ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy