Netflix BTS

Netflix BTS

Microservices

Previously, developers built applications in a way that is now known as the monolith: The project starts off small, then they just added something here, bolt on a new feature there. Then fast-forward a year or two and you suddenly have this monster of a project where you change one thing and the whole system can break. Everything is interconnected. t’s also much harder to scale this type of system. It’s just one monster project, so you end up having to scale by throwing more servers at it, which ends up being very expensive.

Why do tech giants prefer microservices?

  • It’s a flexible and efficient approach to building and operating software.
  • Microservices architecture splits large applications into (much) smaller pieces that exist independently of each other.
  • Each microservice, or piece of an application, does one thing and does it well.
  • Microservices take a significant amount of work – i.e. what goes into building, deploying, and updating an enterprise application – and break that work into more manageable, efficient batches.

Okay……but how is this related to Netflix?

Let’s take some instances:

You want to pick up on a show you’ve stopped watching somewhere in between. You just have to click the play button and it automatically starts from the same time you’ve dropped off. You’re not able to decide what to watch but Netflix magically recommends something you would like based on your past views. You can also see the top trending series or movies in your location. There are several such features offered by Netflix, which makes it the most liked streaming platform in the world. What the user doesn’t know is that there are several services called to make it such an easy experience for them.

It is said that Netflix uses around 700 microservices. These are responsible in keeping around 98 million users satisfied. The best part is that they don’t have to directly depend on other services for their functioning. And that means that even one is down, the users barely notice it. It doesn’t disrupt any other service as well. We’ll just look at some features which you see on your home screen and see how they integrate to form such a huge platform.

Architecture

  • Clients – Different users from various devices send requests. 
  • Identity Providers – Authenticates user or clients identities and issues security tokens.
  • API Gateway – Handles client requests.
  • Static Content – Houses all the content of the system.
  • Management –  Balances services on nodes and identifies failures.
  • Service Discovery – A guide to find the route of communication between microservices.
  • Content Delivery Networks – Distributed network of proxy servers and their data centers.
  • Remote Service – Enables the remote access information that resides on a network of IT devices.
  1. When you click on the show you want to watch, your request is sent to the Identity Provider. It authenticates your request by identifying you as a regular user.
  2. These requests are passed to the API Gateway which acts as an entry point for the user to forward their requests to the appropriate microservices.
  3. Each feature has its own working microservice, handling their own data. These microservices also have their own load balancers and execution environments to function properly.
  4. Each microservice is handled by a small agile team such as content team, video uploading team, most trending team, search team etc.
  5. These small teams of developers relate each and every piece of content with the metadata that describes the searched content. Then, metadata is fed into another microservice i.e. the search function which ensures the user’s search results are captured into the content catalog.
  6. Then, another microservice i.e. most trending microservice captures the trending content among all the Netflix users according to their geographical locations.
  7. The content from this microservice is what you see when you first log in (home screen).

  8. Microservices use service discovery which acts as a guide to find the route of communication between each of them. They then communicate with each other via a stateless server i.e. either by HTTP Request/Message Bus.

  9. These microservices communicate with each other using an Application Program Interface(API).
  10. After the Microservices communicate within themselves, they deploy the static content to a cloud-based storage service that can deliver them directly to the clients via Content Delivery Networks (CDNs).

  11. So, when you search for your show, the search microservice communicates with the content catalog service in API about what you are looking for and then these microservices compare the typed words with the metadata they already have.
  12. Once the teams of developers capture the most typed words by you, the analytics team update the code in recommendations microservice and compare your most viewed content and preferences to popular content among other users in the same geographical region.
  13. When you log in, you not only see the most popular content but also find a personalized playlist which contains the shows you has previously viewed. 
  14. Netflix has a cloud based infrastructure and they use..wait for it….AWS. They help Netflix  to run microservices, to store movies, to handle internet traffic and most important of all, security. 
  15. 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.
  16. 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. Here is a wider picture of what we’ve seen so far:

Damn! There’s a whole other world out there. We just explored a very tiny bit of it. There are teams who test for security, for video quality, patenting and a lot more. Netflix was one of the earliest company to follow the divide and conquer method which lead to more efficient functioning and easy maintenance. Similar to this architecture is Spotify, another vast growing enterprise and a new feature added roughly every month. They have a pattern something similar to Netflix and using this, they are able to maintain millions of users and playlist.

There is a lot more to microservices. You can get started with this website

Prakruthi Maanjunath
Prakruthi Maanjunath App Developer | Engineer | Reader
comments powered by Disqus