Have you ever wondered about the powerhouse behind your binge-watching sessions? I'm talking about Netflix's smooth, almost seamless streaming service. It all comes down to the microservices architecture design at Netflix.
This is no ordinary architectural masterpiece; it's a symphony of small services working in harmony, like an orchestra playing Mozart.
I'll let you in on something – this wasn't always easy for them. But when they got it right... oh boy! Their microservices architecture became their magic wand!
We're diving into how this magical tool works and why it matters to us (and Netflix!). By sticking around, you'll learn about its benefits, challenges faced by Netflix during implementation, and critical components that make up this system.
Sit tight as we embark on this exciting journey through the digital labyrinth of microservices at Netflix.
This is How Netflix Microservices Architecture Works in an IT Infrastructure
Although Netflix was launched in 1997 as a DVD rental startup, it took eight years to realize the power of the cloud. In 2008, due to the heavy demand for DVDs, Netflix began an infrastructure transformation that shut down their in-house data center and business operations for 3-4 days, forcing them to embrace scalable, robust data infrastructure management.
And then everything changed.
Since then, Netflix started wholeheartedly adopting AWS or Amazon Web Services for managing their entire application and IT infrastructure, and they replaced their existing monolithic architecture hosted on their data servers loosely coupled with microservices architecture hosted on the public cloud.
Due to deciding to institute microservices-based architecture powered by public cloud from AWS, they could ensure no point failure and extremely scalable IT infrastructure to support millions of requests without any single service hiccup.
Unprecedented Scalability With Microservices-Based System Architecture
In the microservices-based architecture that Netflix deployed, more extensive software programs are broken down into smaller programs or components based on modularity, and every such part has its data encapsulation.
Microservices choosing the same database causes them to be dependent on each other. Due to this, Netflix can scale its different services independently and rapidly via horizontal scaling and workload partitioning as part of new features of the microservices-based architecture.
If any smaller software program is not working or slowing down the system requests, the engineers can quickly isolate that component and ensure uninterrupted service. Tracking of every individual software component is also possible with microservices-based architecture.
Data Hosting and Content Delivery Network
As per available reports and blogs by renowned experts, Netflix's system infrastructure has two main components:
AWS or Amazon Web Services for hosting the data centers
An in-house network for content delivery for serving the requests
Both components should work concurrently and in sync to deliver timely content and streaming services.
Regarding software architecture, the Netflix delivery architecture has three critical components: Client, Backend, and Content Delivery Network (CDN).
While the client can be any supported browser where Netflix can be accessed or their mobile app, the backend comprises AWS-based services, databases, and storage, which handles everything besides streaming videos.
Some critical part of Netflix's backend contains:
AWS EC2, which are scalable computing instances
AWS S3, which is a scalable storage
Business logic microservices, which are custom-built and task-oriented frameworks
AWS DynamoDB and Cassandra, which are scalable database structures
WS EMR, Hadoop, Spark, Flink, and other tools for big data processing
Video processing and transcoding tools, custom-built by Netflix
And finally, the Open Connect CDN, a robust network of servers, is deployed for streaming and storing videos on a mass scale.
These are called Open Connect Appliances (OCAs), and they are optimized for seamless performance in data centers via fast streaming of video and fast retrieval of this video based on the service requests.
Infrastructure for Video Playback
So, what exactly happens when a user clicks or taps on the playback button?
A chain of events is triggered this way after the playback button is activated:
The Open Connect Appliances or OCAs will constantly share their health reports with Cache-Control services, detailing their workload status, routability, and available videos. This way, the AWS EC2 will know which OCAs must be sent to the clients for Playback Apps to respond.
The play request is sent from the Client to the Playback Apps running on AWS EC2 to fetch the URLs of the requested video.
Playback Apps then validate the request by checking the user's subscription status, availability of the video licensing based on geographical locations, and more.
After the validations, Steering services will talk with Playback Apps about the eligible OCAs for that specific video request. Steering service and Playback Apps are running on AWS EC2 instances, accelerating this process. Steering will use the user's IP address and ISP information to find the best OCAs for this request.
After this, the Playback apps send a minimum of 10 OCAs to the client for streaming that video. The client chooses the best OCA based on their speed, past performance, and quality to stream that video for the user.
And all these steps happen within less than 1 second.
Decoding Backend Netflix Architecture
As shared earlier, the backend comprises databases, storage, and everything besides the streaming process that Playback apps handle.
Here, microservices-based infrastructure is also deployed for handling backend activities, and other services include user management, billing, subscription management, video transcoding, personalized user recommendations, and more.
Here is the possible backend infrastructure of other microservices of Netflix, based on the available reports and blogs shared by experts in this domain:
Now, this is what happens during one service request placed for the backend infrastructure:
AWS Load balancer (ELB) handles the request for Playback sent by the Client to the backend, running on AWS.
AWS ELB will then forward this request to the API Gateway Service running on AWS EC2 instances. Netflix has developed a component named Zuulx for handling these backend requests by AWS ELB, and it allows advanced features such as dynamic routing, traffic monitoring, security, and data safety, besides ensuring zero points of failure.
From Zuul, the request is forwarded to the Application API component, the core business logic that powers Netflix. In our example, the request is of Playback, and for this, Play API is engaged under API Gateway Service. Other corresponding APIs are deployed under the Application API component for further requests, such as user authentication or subscription checks.
Now, Play API will call a microservice or a sequence of microservices to fulfill this request. In our example, the Playback Apps, Steering, and Cache-Control are being deployed as microservices for fulfilling the request by Play API.
Hystrix is a very advanced program developed by Netflix that isolates every microservice from the other, enables minimum failures, and enables unprecedented resilience for ensuring higher success rates of fulfilling requests.
Microservices can also be used to track the users' activities and their history and other data to Stream Processing Pipeline for real-time recommendations and suggestions for enhancing engagement and user experience.
The processed data from the Stream Processing Pipeline is then fed to big data processing tools such as AWS S3, Hadoop HDFS, and Cassandra for the following action.
This is how Netflix's infrastructure works, serving clients' requests and delivering a powerful performance.
In the next part, we will decode the components of Netflix's microservices infrastructure and more.
Connect with us to learn more about our Netflix app development company and how we can assist you in launching similar apps like we helped Netflix dominate your niche.
We have some of the most talented and passionate streaming app developers and system architects who can understand your needs and suggest the best way forward.
Schedule a no-obligation consultation with our Mobile App Engineers today!