What happens when you click play on NETFLIX ?

Faraaz Khan
6 min readJul 18, 2019

Digital entertainment in India will be bigger than the world’s largest film industry. That’s because more and more Indians are logging on to services like YouTube, Hotstar and Netflix on smartphones and smart-TVs .Netflix is now a global force, it’s committed to creating high-quality original shows and movies that can’t be seen anywhere else, with a strategy built around binge watching.

This post will going to be on tech-side, so if you want to know about the tech behind the service then stay tuned. If you are not a techy then go and enjoy your show on Netflix with some cool series releasing this week .

Netflix seems so simple. Press play and video magically appears. Easy, right? Not so much. So lets get started ……

WHY ?

In fact, I’d like to thank Netflix for being so open about their system architecture. Over the years, Netflix has given hundreds of talks and articles on the same. Another reason for going into so much detail on Netflix is Netflix is just plain fascinating. Most of us have used Netflix at one time or another. Who wouldn’t love peeking behind the curtain to see what makes Netflix tick?

Hundreds of microservices, one giant service

Lets just understand how NETFLIX structured on the technical side with some example .

Let assume you Activity App on your smartphone tracks all your fitness activity and store all the relevant information in a file — activity.txt . And someday you end up creating a new app called MyFitnessTracker for you which can access that activity.txt file and shows all the vitals records tracked by Activity app on your App. Simple and your app works flawlessly, you rocked .

Now after some days on your smartphone updated and now its no more store information in activity.txt instead they use database for the same. Hmm now you got a problem , your app crashes because its unable to find activity.txt in the system, and you lost all your important data from your app .

All your work on MyFitnessTracker has gone into the trash because a change was made to Activity App that broke your app. And while it might not seem a big deal here, on a huge service like Netflix the entire application going down because a change was made to one part of it can not only ruin the experience for users, it also means that all other parts of the application have to be rewritten to accommodate that one tiny change you made to one part of the app. Such structure is what we known as Monolithic Architecture .

Netflix started their streaming services somewhere in 2007 , and they built two data-centers, located right next to each other. They experienced all the problems we talked about because with increase in demands they started scaling their system based on vertical scaling strategy . Netflix made big programs that ran on big computers. This approach is called building a Monolithic Architecture . One line statement for this will be — One program did everything. The problem is when you’re growing really fast like Netflix; it’s very hard to make a monolith reliable.

At that time, Netflix decided to move to AWS . AWS was just getting established, so selecting AWS was a bold move.

Turn Around

Netflix made decision by rewriting the applications that run the entire service to fit into a microservices architecture — which means that each application, or microservice’s code and resources are its very own. It will not share any of it with any other app by nature. And when two applications do need to talk to each other, they use an application programming interface (API) . Developers can now make many changes, small or huge, to each application as long as they ensure that it plays well with the API. And since the one program knows the other’s API properly, no change will break the exchange of information.

From Servers to Screen

I have break down the process into steps let discuss , first after receiving the content from producers they -

  • Store the original digital copy of the show or movie on to their AWS servers. The original copies are usually in high-quality cinema standards, and Netflix will have to process these before anybody can watch it.
  • Netflix works on thousands of devices, and each of them play a different format of video and sound files. Another set of AWS servers take this original film file, and convert it into hundreds of files, each meant to play the entire show or film on a particular type of device and a particular screen size or video quality. One file will work exclusively on the iPad, one on a full HD Android phone, one on a Sony TV that can play 4K video and Dolby sound, one on a Windows computer, and so on. Even more of these files can be made with varying video qualities so that they are easier to load on a poor network connection. This is a process known as transcoding. A special piece of code is also added to these files to lock them with what is called digital rights management or DRM — a technological measure which prevents piracy of films.
  • The Netflix app or website determines what particular device you are using to watch, and fetches the exact file for that show meant to specially play on your particular device, with a particular video quality based on how fast your internet is at that moment.

The last part about fetching is the one that is most crucial for Netflix here, because after all, that is where the Internet network delivers the video from Netflix’s AWS servers to the customer’s device. If it’s poorly managed or ignored, it means a really slow or unusable Netflix and virtually the end for the company. The internet is the umbilical cord that connects Netflix to its customers, and it takes a lot for them to deliver the content a user wants, in the shortest time possible. On a really crowded network where millions of services compete for space.

The entire gamut of operations that build up the Netflix ecosystem — software, content, and technology — is rendered useless if the end user’s internet connection is too poor to handle the video quality. They do this by building something called a Content Delivery Network (CDN).

What CDNs basically do is, they take the original website and the media content it contains, and copy it across hundreds of servers spread all over the world. So when, say, you log in from India, instead of connecting to the main Netflix server in the United States it will load a ditto copy of it from a CDN server that is the closest to India. This greatly reduces the latency — the time taken between a request and a response, and everything loads really fast. CDNs are the reason why websites with a huge number of users like Google, Facebook, or YouTube manage to load really fast irrespective of where you are or what the Internet speed is like.

In a nutshell….

This is what happens when you hit that Play button:

  • Hundreds of microservices, or tiny independent programs, work together to make one large Netflix service.
  • Content legally acquired or licensed is converted into a size that fits your screen, and protected from being copied.
  • Servers across the world make a copy of it and store it so that the closest one to you delivers it at max quality and speed.
  • When you select a show, your Netflix app cherry picks which of these servers will it load the video from.
  • You are now gripped by SACRED GAMES given opinion on Mr.White (BREAKING BAD ), and made phobic to the future of technology by the stories in BLACK MIRROR (my fav).

It looked so simple before, right?

--

--