Member-only story
System Design Interview: Mini YouTube
Design a video service like YouTube, or Netflix. I don’t know if companies really ask this question, but it’s in a lot of system design materials. I skimmed through many, most of them are not as technical as I’d like. So I decide to write my own, and I hope that it offers a different view to you.
As always, let’s clarify what we are trying to design here. YouTube is so broad. But at the very minimum, we should expect content creators to be able to upload their videos; viewers can find the videos they are looking for, and then binge on them. Those are the fundamental functions of a video service site. One can have all kinds of fancy features such as recommendation, subscription, ads, community engagement, etc. But without a solid foundation, everything will eventually fall apart. So, let’s restate, our goals are easy upload, flexible search, and fast reviewing. Let’s go through them one by one.
Video Upload
Video upload is relatively straightforward, assuming that users have some kind of client (most likely a frontend app in browser) that can talk to the server. The client just needs to read the local video file and upload that to the server. YouTube has many supported video formats, and a set of recommended encoding settings. The encoding jargon seems quite daunting. Let’s explain them a bit. The container format is the video file format (e.g. MP4). It’s a wrapper around the actual content to provide some additional information. The codec is a shorthand for encoder and decoding. It describes how…