System Design: Netflix's Complete Architecture

What is Netflix?

Netflix is a popular streaming service that offers a vast catalog of movies, TV shows, and original content. It's available on smart TVs, through streaming devices, and even on your smartphone and tablet using the official app for iOS or Android.

It handles large categories of movies and television content and users pay the monthly rent to access these contents.

Netflix works on two clouds…AWS and Open Connect. These two clouds work together as the backbone of Netflix and both are highly responsible for providing the best video to the subscribers.

The application has mainly 3 components…

  1. Client: Device (User Interface) which is used to browse and play Netflix videos. TV, XBOX, laptop or mobile phone, etc

  2. OC (Open Connect) or Netflix CDN: CDN is the network of distributed servers in different geographical locations, and Open Connect is Netflix’s own custom global CDN (Content delivery network). It handles everything which involves video streaming. It is distributed in different locations and once you hit the play button the video stream from this component is displayed on your device. So if you’re trying to play the video sitting in North America, the video will be served from the nearest open connect (or server) instead of the original server (faster response from the nearest server).

  3. Backend: This part handles everything that doesn’t involve video

    streaming (before you hit the play button) such as onboarding new content, processing videos, distributing them to servers located in different parts of the world, and managing the network traffic. Most of the processes are taken care of by

    Amazon Web Services.

    Netflix frontend is written in ReactJS for mainly three reasons…startup speed, runtime performance, and modularity.

    Netflix's backend consists of a bunch of micro-services collaborating in a loosely coupled fashion.

    This kind of setup helps deliver large, complex applications quickly and reliably.

The figure below is an overview of Netflix's backend Architecture.

  1. The client sends a play request to a backend running on AWS. Netflix uses Amazon's Elastic Load Balancer (ELB) service to route traffic to its services

  2. AWS ELB will forward that request to the API Gateway Service. Netflix uses Zuul as its API gateway, which is built to allow dynamic routing, traffic monitoring, and security, resilience to failures at the edge of the cloud deployment.

  3. The heart of Netflix's operations is the Application API component, with various APIs for things like signing up or providing video recommendations. In this scenario, the Play request gets handled by the Play API.

  4. Play API will call a microservice or a sequence of microservices to fulfill the request.

  5. Microservices are mostly stateless small programs, there can be thousands of these services communicating with each other.

  6. Microservices can save or get data from a data store during this process.

  7. Microservices can send events for tracking user activities or other data to the stream processing pipeline for either real-time processing of personalized recommendations or batch processing of business intelligence tasks.

  8. The data coming out of the Stream Processing Pipeline can be persistent to other data stores such as AWS S3, Hadoop HDFS, Apache Cassandra, etc.

  9. To send push notifications, Netflix uses distributed messaging queue.

  10. Open Connect is Netflix’s custom global content delivery network(CDN). These OCAs servers are placed inside internet service providers (ISPs) and internet exchange locations (IXPs) networks around the world to deliver Netflix content to users.