How does Netflix work behind the screen?
Netflix System Design and Architecture.

Netflix has reported to have over 182 million subscribers worldwide in the first quarter of 2020 (Of course, these numbers don’t include freeloaders like me, who’s family or friends have been generous enough to share their account and password). It shouldn’t be surprising that 16 million of these subscribers have joined in the first three months of this year as compared to 5 million new subscribers per quarter earlier.
The current crisis has impacted many aspects of the entertainment industry, including some of Netflix’s, like its production house. However, Netflix has largely benefited as it doesn’t stream sports events, doesn’t have advertisement on the platform, doesn’t need movie theaters. Well, mostly.
To prepare for job interviews, I recently started teaching myself about system design and architecture. While doing so I got a chance to learn the fascinating design model of Netflix. Its architecture is so intriguing that I believe it would fascinate the people outside the tech community as well. This article attempts at describing some of Netflix’s most riveting pieces of working in layman terms. I think even fairly experienced techies might get something out of it, especially if cloud architecture and system design is your discipline.
I have consolidated this article from various sources and tried my best to collect the updated and correct information. As quoted by Todd Hoff , “Facts on the ground change over time and depend on who is telling the story and what audience they’re addressing ”. So, if you find any mistakes or inaccuracies, kindly bring them to my notice.
Before getting into the nuts and bolts of the architecture, let’s look at some of the most interesting user experience enhancements which Netflix has integrated into its system.
The Recommendation System
Netflix Recommendation Algorithm has been quite popular with the people studying data analytics. Netflix has a humongous collection of user data and is still collecting more with every new user and user activity.

It accounts numerous metrics from this dataset to build the algorithm, some of which are:
- Your viewing history and ratings are the ones you must have guessed already. Netflix can make great suggestions based on the type of movies you watch and how you rate the movies you have watched. You must have noticed Netflix doesn’t use IMDb ratings (or any other world average rating) to suggest you any movies. Instead it believes that each user is different and would not necessarily agree with the world’s average opinion about the show. Hence it focuses on an individual’s watch history with other factors and finds a pattern about each user’s choice.
- Other viewers with similar tastes and choices. This algorithm is known as Collaborative Filtering (CF). It is based on the idea that if two clients have similar rating history they will behave similarly in the future. For example, if one of the two similar users rates a movie with a great score, it is more likely that the other user would like it as well and hence Netflix will recommend it to the other.
- Titles, genres, actors, release year etc. This configures the Content Based Filtering (CB) algorithm. This algorithm recommends movies based on the kind you have liked before. The main difference from CF is that CB offers recommendations based not only on similarity by rating but is more about the information from the products. For example, recommending movies by the same actor you liked before. These factors with user profiling help in learning user preferences.
- User profiling includes information like the time of the day when you watch, the device you watch it on, the duration you watch for etc. For example, if you show a pattern of not sitting at lengths, Netflix will try to find short movies or shows with small episode run-times for you.
Personalized Artworks
Data analytics doesn’t just stop at the recommendation system. Netflix is highly data-driven and uses its analytics to appeal you to watch more. If you have ever logged in through different accounts, you may have noticed that Netflix doesn’t use the same header images for a show, for all the users.

For example, here are different header images for Stranger Things. Each of us would see a different artwork decided by Netflix. Netflix considers various factors to choose the image that would best entice you to watch the show. It will also account for something basic like the number of clicks a certain image receives. The image with most clicks or popularity, then makes as one of the factors in the algorithm.

Have a look at another example for the artwork of the movie, Good Will Hunting. Based on your preferences and viewing history, if Netflix predicts that you like comedies it will show you the image of Robin Williams for this movie. If you like romantic movies, Netflix will show you the image of Matt Damon and Minnie Driver, to tell you it has elements of romance as well.
As you can see how important it is to select the right header image, as it sends a strong personal message of what the movie is about and would allure the user to watch it.
Netflix High-Level Architecture
The architecture can be divided into 3 major components:
- Client
- Back-end
- Content Delivery Network (CDN) / Open Connect (OC)
Client: Client is any Netflix application on the end user’s device. It could be a web browser on your laptop, an app on your phone, smart TV or gaming console. It is the interface which helps you browse and watch your favorite shows on Netflix.
Back-end: This is the section where everything happens before you hit play, on-boarding new content, processing videos, distributing them on servers located in different parts of the world and managing the network traffic.
Almost all of these processes take place on Amazon Web Services (AWS). Netflix moved to AWS in a quest for a reliable infrastructure. AWS offers highly reliable databases, storage and redundant datacenters. This move to cloud services (AWS) came from the 3 days of downtime Netflix faced, in August 2008 due to corruption in their datacenters. Those datacenters were big, unreliable monliths and with the given growth at Netflix it needed much reliable and scalable microservices architecture . AWS along with addressing all these issues surprisingly turned out to be cheaper as well. As cloud came with elasticity, Netflix was required to pay only as per their use. While the datacenters Netflix had built were to be managed all the time and added costs even when most of them were not in use. And currently, Netflix runs on several thousands of AWS EC2 instances.
CDN / OC: OC is Netflix’s own custom global CDN. To understand what OC is, let’s first take a quick look at CDNs.
Content Delivery Network / Content Distribution Network (CDN)
CDN as defined by Wikipedia is a geographical distribution of proxy servers and data centers. The goal of CDN is to make the website faster. To be specific, it provides quick access to the internet content like videos, images, HTML pages etc. to help it load on the website faster.
Before studying how it accomplishes the speed, let’s look at the challenge addressed by CDN. Imagine a situation where there are users around the world but a single server in NYC. If a user in Sydney makes a request to access a website hosted in NYC, it would be a 10,000 miles hike upwards to the server and 10,000 miles back to Sydney with the response and this round trip would take around 200 ms, while for a user making the same request from Dallas, it would be about 40 ms. As can be seen, the further one is from the server, the longer it will take for the content to load, in turn slowing down the website.
This is where CDN comes into play, it places server endpoints across the globe thus enabling users to retrieve content from their closest geographical location, drastically reducing the amount of time. Hence resulting in high availability and performance by distributing services spatially to end users.
To summarize this with other benefits provided by CDN, it provides:
- High Availability and Performance (Speed).
- Reduction in load on servers, as requests are now distributed.
- Increase in security through obscurity, as CDN adds an extra layer in between.
You must have guessed it by now, Netflix uses CDN to distribute its video content to serve its customers across the globe. We’ll see later, how OC is different from CDN and why Netflix needed it. Let’s talk about the first step in the Netflix’s model before getting into any other details which is, uploading a new movie on Netflix.
On boarding new Content
Netflix receives new videos from the production houses and studios. These are high quality videos, which need to be processed before serving them to the viewers.
Netflix currently supports about 2200 devices including Android, iPhone, Apple TV, Kindle Fire, Playstation etc. and each of them requires a different video and audio format. With the help of hundreds of thousands of AWS servers Netflix converts the original video into a large number of different formats and resolutions to support different screen sizes and devices. This process is known as Transcoding. Netflix breaks the video into a number of chunks and AWS servers work in parallel to convert these chunks into different formats like mp4, 3gp etc. across different resolutions like 4k, 1080p and more. All these processed video copies are then stored on Amazon S3.
When a user requests to watch a video, Netflix analyzes the network quality and stability of the internet connection the user is on and then based on the device type and screen size provides with the right video format to stream. Have you ever noticed when watching a video it initially looks pixelated and snaps back to HD after a while? Netflix clients constantly keep a check on the health of the network and switch between formats when needed.
System Architecture and Design
- Netflix is built on an architectural style that structures the application as a collection of services. This is known as microservices architecture. Microservices architecture’s core principle lies in decoupling all the services, which means that all services are designed to be independent of each other, for example, the video storage service would be decoupled from the service responsible for transcoding videos.

- This architecture is highly designed around business logic and allows flexibility in addressing individual needs of services. If you learn that the system is facing a bottleneck in storing videos, you can efficiently plan to scale up or optimize the storage logic without changing the resources configuration for other services. As opposed to this, in a Monolithic architecture, where all the components are interconnected, you would need to scale the whole system just to address the need of one service. This would significantly hike up the cost and hit the growth cap soon.
- Netflix, built on the microservices architecture and the distributed system of AWS, achieves reliable and scalable computing and storage with the help of AWS EC2 and S3. Cassandra and DynamoDb are the distributed databases used to store data like user profiles, billing information and other information like the movies that you have watched, which is then used in building the recommendations algorithm.
Need for Custom CDN, Open Connect
Now you know that the idea of CDN is to put servers as close to the users as possible and optimize the network for speed and reliability. Why do you think Netlfix needed to build it’s own CDN?
Netflix started off by using third-party CDNs which was the right option at that time. By not building it’s own CDN Netflix focused on other aspects of the system like developing algorithms for recommendation system, streaming high-quality videos and enhancing user experience.
Third party CDNs provided support to all types of content but Netflix was primarily concerned by just one, videos. Netflix at its scale, soon realized that by having a custom CDN with exclusive support for just large video streaming, it could create a high-performance network, notably enriching the user experience. And in 2011, Netflix created the same, Open Connect. The advantages offered by Open Connect were:
- Less Expensive- Compared to third-party, in house CDN was a cheaper option for Netflix.
- Better Quality- Netflix now had end to end control from transcoding to client application, thus achieving better quality.
- More Scalable- With more control over the network, Netflix was closer to its goal of reaching everywhere in the world.
Open Connect Appliances
OCA is a fast server assembled from lots of hard disks and flash drives for storing videos. Hardware wise, there is nothing special about OCA, they’re based on commodity PC components and assembled in custom cases by various suppliers. You could buy the same computers if you want to.

Netflix places these boxes with the datacenters of Internet Service Providers (ISPs) all over the world. ISPs are your internet provider. It’s who you get your internet service from, like Verizon, Hathway, Airtel etc.
ISPs are located all around the world close to their customers, which was the exact strategy Netflix was building its solution around. By using ISP datacenters to place OCAs with relevant videos, Netflix gets all the benefits of a datacenter but doesn’t need to manage it.
But if you remember all the processed movies are stored in Amazon S3. How does Netflix get it to OCAs? It is achieved by the process called Proactive Caching. Netflix is known to have highly accurate predictive system. It already knows what the viewers in different locations would like to watch next and when they would like to watch it as well. The predicted videos are copied to OCAs at respective locations and by having movies readily available to stream even before viewer has asked for it, Netflix ensures a great viewing experience.

Putting All The Pieces Together :
- The original high quality copy of the movie received from production houses is first uploaded to AWS S3.
- It is then broken down into chunks to transcode. After all the processing, multiple copies of the movie in are stored in S3, in different formats and resolutions to support across various devices and networks.
- Next, the locations where people would prefer to watch this movie are predicted. These copies are then duplicated on OCAs closest to the predicted locations in advance, ready to serve the viewers when requested.
- When you request to play the movie, the app on your device fetches URLs for up to 10 different OCAs. The quality of network for these OCAs is then tested by the clients and the fastest and most reliable connection is selected.
- Client constantly keeps on checking the connection and switches to the most stable and high-quality connection possible whenever needed, trying all the while to deliver a smooth viewing experience.
Pretty amazing, isn’t it?

References:
- https://www.statista.com/statistics/250934/quarterly-number-of-netflix-streaming-subscribers-worldwide/
- https://www.nytimes.com/2020/04/21/business/media/netflix-q1-2020-earnings-nflx.html
- https://youtu.be/Bsq5cKkS33I
- https://youtu.be/x9Hrn0oNmJM
- http://highscalability.squarespace.com/blog/2017/12/11/netflix-what-happens-when-you-press-play.html
- https://medium.com/@narengowda/netflix-system-design-dbec30fede8d
- https://medium.com/refraction-tech-everything/how-netflix-works-the-hugely-simplified-complex-stuff-that-happens-every-time-you-hit-play-3a40c9be254b