System Design for Product Managers: Netflix Case Study

--

Basic Architecture of Netflix and other OTT Platforms for Product Managers or non-tech guys!

Photo by Venti Views on Unsplash

Disclaimer

This story or blog is basically for Product Managers who belong to a non-tech background that’s why we have taken our own assumptions and way of architecture. Real architecture may differ from this case study.

Hola Tech & Product Geeks!

We-all know that product management is a weird job-role.

You do everything from market research to deploying a SAAS product.

And that’s why, we say that Product Management is “Jack of all Trades”.

In product interview, a candidate appears for different rounds:

  1. Behavioural
  2. Technical (SQL | System Design | Techstacks | Cloud | Machine Learning)
  3. Product Sense
  4. Analytical
  5. Strategy

For Product Sense & Analytical question, you can checkout my blog on “Frequently Asked Questions in Product Management Interviews”.

Although! In this story, we are going to discuss that how does a product manager approaches System Design Questions in Technical Interview round.

So, let’s get started!

Problem Statement & Prerequisites:

“Design Netflix for 100 Million Active Users”-> Yep! for now it’s enough to understand the whole process.

Things You’ll need to understand:

  1. Understanding the Architecture Components
  2. Translate features into Engineering Components
  3. How Components fit together

Now, before proceeding towards the solution part. You’ll need to learn basics of Architecture Components. So, you can checkout Exponent’s Videos & Gaurav Sen’s Youtube Channel.

Approach to the System Design Question of a Product Manager

So, there are mainly four steps to build “Netflix” for 100 Million Active Users.

  1. Gather Requirements
  2. Architecture Components
  3. Design Database(In this blog we refer this to a NoSQL and SQL DB)
  4. Design Services

Let’s discuss each process one-by-one.

#1 Gathering Requirements

While gathering requirements for any SAAS product, you will have to understand that there are mainly two kinds of requirements:

  1. Functional Requirements: These requirements are demanded by the end-users of the system. It depicts what functions the system must have.
  2. Non-functional Requirements: These requirements deal with quality of functions, and that’s why non-functional requirements can also be understood as Quality Constraints that system must satisfy.

Now, let’s apply this to Netflix:

Functional Requirements:

  1. Uploading Videos
  2. Account Creation and LogIn
  3. Searching Videos
  4. Watching the video

Non-functional Requirements:

  1. No/Minimal Buffering(Viewers)
  2. Low Latency(Viewers)
  3. High Availability(Viewers)
  4. Uploads should be fast(Content Creators)

#02 Architecture Components

In the section, you will decide what components you are going to have for the system on a macro-level basis.

So, what components we need are:

  1. Microservices
  2. Databases
  3. Load Balancers
  4. CDN(Content Distribution Network)

We will discuss about everything one-by-one when it will be needed.

For example, Suppose that you work with a few Product Houses(Consider Peaky Blinders 😅) so how will they upload their videos?

Well! Let’s start from the basics. Content Creators or Product Houses will have an interface which would be provided by the Netflix.

Basic Design for Content Creators or Production Houses

Now, They upload their service via “Upload Video Service” and it will get uploaded to the Database. Right?

But now so many questions are roaming within your mind?

Wait! what is this “Upload Video Service”?

So basically it’s a microservice.

#1 Now what is a Microservice?

Microservice is an architectural and organizational approach to software development where software is composed of small independent services that communicate over well-defined APIs.

#2 What is a Load Balancer?

Load balancers increase the fault tolerance of your systems.

  • Detects server problems
  • Redirects client traffic to the available servers

You can use load balancing to make these tasks easier: Run application server maintenance or upgrades without application downtime.

#3 What is a Content Delivery Network(CDN)?

CDN(Content Delivery Network): Source

How Netflix Brings the “Sex Education” Party to Your Screen with CDN Magic?

Alright, let’s break it down from a product manager’s perspective:

1. Netflix.com Request: Imagine you’re a product manager and you want to watch “Sex Education” on Netflix. You type in Netflix.com, but here’s the deal — you’re not directly talking to Netflix. Instead, you’re like dialing your ISP (Internet Service Provider), asking them to hook you up with Netflix.

2. ISP Magic: Your ISP plays the role of a middleman, acting as your Netflix matchmaker. It contacts the Netflix servers, mainly hanging out in the US, and says, “Hey, our buddy here wants ‘Sex Education’!”

3. The Geography Quirk: Now, if you’re sitting in a far-off place like Bangalore, India, here’s where the funny part kicks in. Because those Netflix servers are a long way away, it’s like snail mail in the internet world. Your request takes time to travel to the US and back with your video. Not cool, especially for videos, where you need a ton of data. Slow data is like slow-mo in a comedy movie — not funny at all!

4. Netflix’s “Magic Wand” — Open Connect (OC) CDN: But wait, Netflix has a trick up its sleeve, and it involves the CDN (Content Delivery Network) magic. Imagine OC as Netflix’s super-smart, world-traveling magician’s assistant, and CDN as the magic toolkit.

5. Netflix’s “Local Magicians” — ISPs with CDN: Netflix teams up with ISPs all over the globe, like the cool magicians’ club, and equips them with CDN magic. They set up their own mini Netflix storage (cache) with all the hit shows, including “Sex Education.”

6. No More Long-Distance Calls: So, when you want to watch “Sex Education,” your ISP doesn’t have to dial all the way to the US servers. Nope, they just pull it out of their local Netflix magic hat, thanks to the CDN. This means your video loads faster than a rabbit in a carrot race.

7. Happy Viewers Everywhere: Thanks to this Netflix CDN magic trick, you get to enjoy “Sex Education” (and all your other faves) without those annoying delays. It’s like having the best seat at a comedy show — no waiting, just non-stop laughter (or in this case, drama).

So, Netflix’s Open Connect (powered by CDN magic) and its magician-like partnership with ISPs ensure that “Sex Education” is ready to entertain you wherever you are, with no long-distance buffering nonsense. Now, that’s some seriously good PM wizardry! 🎩✨

Now, let’s proceed towards Databases.

#3 Design Databases

Databases

We are using two databases here:

  1. Object/blob Storage: Object storage is a type of NoSQL database which deals with unstructured & large files.
  2. Metadata DB: This database is basically a MySQL database which stores the various data related to specific files or videos or records.

Now, let’s deep dive into this:

#4 Design Services

There are mainly 3 micro-services on the basis of our functional requirements:

  1. Upload-Video-Services
  2. Search-Services
  3. View-Video-Services

#1 Video-Upload-Services

Let’s add some more elements into the system:

Video-Upload-Service Source: LinkedIn
  1. Load Balancers
  2. Video-Splitters
  3. Processing Queues
  4. Video Encoder

Why a Load Balancer is needed?

So, as it’s our assumption that AMAZON PRIME VIDEO is dealing with almost 100 Million Users or maybe more than that.

There will be bunch of requests which will hit the servers via APIs.

But what if a server will fail?

Yes! We will use load balancers. It gets increased as the users increases.

But!

Chunk-Based Video Storage

Instead of keeping a big video as a single file, we break it into smaller parts or “chunks.” This is important because sometimes people upload really large videos. Dealing with one huge file can take a long time. So, we chop it up into pieces.

Why? Well, when we store and serve videos in chunks, it’s much better for the viewers. Instead of waiting for the whole video to download, they only need to get the first chunk from our server. While they’re watching that part, their device can ask for the next chunk. This way, there’s very little delay between the parts, and it feels like a smooth, uninterrupted video.

Video Splitting Microservice

Think of this like a special job handled by a part of our system called the “video splitter.”

Its main task is to cut the video into these smaller pieces or chunks and put them in a line called the “processing queue.

As they come out of the queue, we change these chunks into different formats, like we discussed earlier. This makes sure that viewers get a great experience when they watch videos on our platform.

Onboarding or Uploading a Video on an OTT Platform or Netflix (Source)

What are the Processing Queues?

In the Netflix system, we use a processing queue to handle videos more efficiently.

Think of it as a line where we put all the different parts of a video that need to be worked on.

This helps us because we have many pieces of a video to process, and we want to do it all at the same time.

So, we put these pieces in the queue, and our workers (we’ll talk about them in a bit) take the tasks from the queue, turn them into different types, and save them in our storage.

What is Video Encoding?

Now, here’s why we need to change video formats.

  1. Multiple Devices: People watch Netflix on various devices like phones, laptops, and TVs. These devices like different kinds of video formats.
  2. Internet Speed: Also, some people have super-fast internet, and some don’t. So, we need to make videos in different formats and quality levels.

Process

  1. Imagine our original video(Peaky Blinders-> I know I am obsessed with this) is huge, like several terabytes big. Netflix is for lots of people with different gadgets and internet speeds. To make it work for everyone, we create more than 1200 versions of each movie or show!
  2. For every video we get, we change it into different formats like mp4, avi, flv, and others.
  3. And for each of these formats, we have different resolutions like 1080p, 480p, 240p, etc.

Now, Let’s go ahead and talk about the flow of a users or viewer's perspective.

#2 Search Service

Search Service(Source)

Search Magic with Netflix’s Sherlock Service

Alright, picture this: You’re in charge of finding “Sex Education” on Netflix, and you don’t want to scroll through a gazillion shows, right? That’s where the Netflix search wizardry comes into play!

  1. Load Balancer — The Traffic Cop: First off, meet our trusty “Load Balancer.” This bad boy’s job is to make sure your search request doesn’t crash Netflix’s servers. It spreads the workload evenly, like a bouncer at a crowded party, ensuring all servers stay cool.
  2. Search Microservice — Sherlock’s Sidekick: Now, our “Search Microservice” is like Sherlock Holmes’ trusty sidekick, Watson. It takes your search request and passes it along to the real detective, Netflix’s “Elastic Search.”
  3. Elastic Search — Netflix’s Search Guru: Elastic Search? Well, think of it as Netflix’s search guru. It’s like that super-smart librarian who can find the right book in a library with millions of volumes. Elastic Search can handle searching through tons of videos. It’s like a pro detective sifting through clues to find “Sex Education” for you.
  4. Bringing You the Show: Once Elastic Search finds the show, it sends the info back to you, the client, like a magician pulling a rabbit out of a hat. So, you get to enjoy “Sex Education” without a hitch. And guess what? Netflix also uses Elastic Search to figure out how they can make your binge-watching experience even better!

So there you have it, the Netflix search magic explained, PM-style! 🕵️‍♂️🎩📺

#3 View Video Service

View-Video-Service(Source)

Netflix’s Video Serving Magic: The Case of “Sex Education

Alright, product managers, imagine you’re craving some “Sex Education” on Netflix (the TV show, of course!). Here’s how Netflix serves it up, with a sprinkle of PM flair:

1. Local ISPs — The Fast Lane: Your video request doesn’t always bother Netflix HQ. Instead, it takes a detour to your local ISP. If your requested show is chilling on one of Netflix’s nearby “Open Connect” servers (like your favorite snack in the office kitchen), your ISP hands it right to you. It’s like instant gratification, PM-style.

2. Open Connect Servers — Your Quick Fix: These servers are everywhere, like coffee stations in a tech office. They make sure you get your “Sex Education” fast. But if your show isn’t hanging out there, we’re on to the next step.

3. Load Balancer — The Decision Guru: Meet the Netflix “traffic cop.” The load balancer, together with the view microservice, dissects your request like PMs dissect user feedback. They figure out what you’re after, like a product feature request.

4. Metadata Database — The Knowledge Base: They consult their “Netflix playbook,” the metadata database, to locate your show’s secret hideout. Once they’ve cracked the code, they follow the trail like PMs tracking user behavior.

5. Client Delivery — The Grand Finale: Finally, your show arrives at your screen, just like when a product launches after months of development. But, here’s the twist — this process can take a bit, like waiting for a meeting to start. That’s why Netflix loves those nearby Open Connect servers; they’re like the express checkout lane for your binge-watching spree.

So, remember, PMs: “Sex Education” and Netflix’s magic are all about finding the quickest route to user satisfaction, whether it’s serving up shows or delivering that next awesome product feature! 😉🍿📺

Hope! You enjoyed this case study.

If you love my blogs then you may buy me a book 📖!

You’re welcome! If you have any more questions or need further assistance, feel free to ask. 😊👍

--

--