Analysis of the Software Architecture of Netflix
Netflix is an American Media-Services Provider and production company. The company’s primary business is its subscription-based streaming service which offers online streaming of a library of films and television programs, including those produced in-house. From a software point of view, Netflix operates in two clouds: AWS and Open Connect. Both clouds must work together seamlessly to deliver endless hours of customer-pleasing video. Netflix also creates files optimized for different network speeds. If you are watching on a fast network, you’ll see a higher quality video than you would if you’re watching over a slow network. Now we have all the files we need to stream it, Open connect (OC) comes into the picture, OC is Netflix own Content Delivery Network (CDN) no third-party CDN. Netflix built MySQL using the InnoDB engine. The loss of a single node is guaranteed to have no data loss. As viewership started to increase, Netflix divided data into two types: (a)Live Viewing History (frequently updated) and (b) Compressed viewing history (rarely updated).
Analysis Models
Analysis models is a technical representation of the system. It acts as a link between the system description and the design model. In Analysis Modelling, information, behavior, and functions of the system are defined and translated into the architecture, component, and interface level design in the design modeling.
Data Flow Diagram
A data flow diagram (DFD) maps out the flow of information for any process or system. It graphically represents the flow of data in a business information system.
Sequence Diagram
Sequence Diagrams are interaction diagrams that detail how operations are carried out. They capture the interaction between objects in the context of a collaboration.
Entity-Relationship Diagram
An entity-relationship diagram (ERD) shows the relationships of entity sets stored in a database. An entity in this context is an object, a component of data. An entity set is a collection of similar entities. These entities can have attributes that define its properties.
Architecture Diagram
An architectural diagram is a diagram of a system that is used to abstract the overall outline of the software system and the relationships, constraints, and boundaries between components. It is an important tool as it provides an overall view of the physical deployment of the software system and its evolution roadmap.
Netflix follows a layered architecture divided into offline and online layers. The architecture of Netflix handles the following operations, streaming offline, download data for streaming online, and a machine learning model for movie recommendation designed specifically for each user.
Quality Attributes Addressed by the Design
The quality attributes we have observed are:
- Availability: Netflix is available in almost all countries (with the exception of China, Syria, North Korea, and Crimea).
- Correctness: Netflix will display the movie or TV show which we have selected and thus always incorporates the quality attribute of correctness.
- Efficiency: Watching TV shows or movies on Netflix uses about 1 GB of data per hour for each stream of standard definition video, and up to 3 GB per hour for each stream of HD video. This is a lot of data that is used and thus, there is potential to reduce it in order to make it more efficient.
- Flexibility: Netflix keeps on adding new shows and movies which they feel will be popular among audiences. Netflix uses data analytics to try to predict whether a show will be liked by the people or not and is then added or not based on data analysis. Also, Netflix has introduced an interactive feature that allows the user to make choices and thus deciding the flow of the movie.
- Portability: Netflix supports 2200 different devices, including Smart TV, Android, IOS, gaming consoles, web apps, etc thereby showcasing that it's extremely portable. All these apps are written in the platform-specific code.
- Reliability: Netflix servers are very rarely down, and in the odd case they do not work, the tech team gets it back up quickly making it very reliable.
- Usability: Netflix has got a very detailed explanation of how it operates through its ‘help center’ which can enable new users to get to know about its features quickly.
- Safety: There is no chance for the user to get any injury as they are just sitting and enjoying the show/film thereby incorporating the safety quality attribute.
Design Style Used in the Design
Netflix uses a simultaneously Heterogeneous design style involving a microservice architecture with independent Communicating micro-processes and data transfer in a pipe and filter design.
Pipe and filter design
Once a video is validated, Netflix uses a pipeline and filter design involving a series of steps to transfer the videos to the client device. A Netflix movie must be streamed in a high-quality print. This might involve a multi-terabyte size video/file, which is difficult to be passed as a single chunk of
data. Therefore, the first step of this pipeline is to break the video into tiny chunks. A parallel system pipe and filter design are used so that each chunk can be processed at the same time. These chunks are placed in a queue and processed before being uploaded into the amazon SVN. Similarly, multiple copies of the same video are created in different resolutions and formats so that the video format that is best suited for the machine can be played. All these copies are then pushed into all the open connections. Once the user clicks on the play button of the desired video, the application finds the best OC server, best format, and best bitrate, and then the video is streamed from a nearby Open Connect Appliance (OCA) in the Open Connect CDN.
All the other user requests including the login, homepage, billing, searching, customer support, user history, etc are handled by the AWS cloud using the microservice architecture.
Cloud-based Microservice Architecture
A microservice architecture design is the primary design of the AWS cloud. The application structure involves a collection of small autonomous services modeled around an ASW cloud. Each autonomous microservice is independent of each other and has a well-defined scope. The microservice architecture in Netflix, powers all the application program interfaces (APIs) needed for the web applications. Each API calls the other microservices for the required data and responds with an acknowledgment message.
The independent microservices are handled with the help of Zuul, Hystrix, and an elastic load balancer. From the architecture diagram, an elastic load balancer is used to route the incoming request traffic to the front end. Zuul acts as an API gateway, receives requests from the UI, and delegates the requests to the internal microservices. Hystrix is used to prevent any latency in the working of the microservices.
Microservices do not share Data structures and only communicate through APIs. This creates a loosely coupled architecture, and therefore independently manageable. Also, enables fault isolation and easy incorporation of new updates.
Discussions
Netflix has three main components, the Open Connect cloud, backend, and the client (device). It operates in two clouds, Amazon Web Services (AWS) and Open Connect (OC). OC is used for anything video related and acts as Netflix’s custom global content delivery network (CDN), whereas AWS is used for anything non-video related. Netflix has a very suitable and efficient way to store the data by dividing it in 2 types: Live viewing History and compressed Viewing History which is used to provide entertainment to millions of people.