How Netflix Works, Explained
A Simplified Look At How Streaming Content Is Delivered
One of the comforts of modern living is streaming video, also called Video-On-Demand (VOD). This brings content like movies and TV shows straight to our devices, anytime and from anywhere. Netflix is the company that has become synonymous with streaming services, bringing OTT (Over-The-Top) network to paid subscribers. This has led to a “cutting the cord”, with previously dedicated cable and dish subscribers moving over to streaming services like what Netflix has to offer. All you need is a fast Internet connection (> 3 Mbps in most cases) and a subscription and you are all set.
Netflix saves you the time to go to the video rental store, eventually eliminating the competition like Blockbuster. The only remaining video rental services, like RedBox, still provide content on disc (Blu-Ray or DVD). The only problem is that since it is a physical item, it must still be returned to the video rental or else there is a fine. The benefits of having Netflix is that there is no late fee or due date on all content they serve. You are not “renting” any material, but “subscribing” to it. Just stream on demand or even download to your device whenever you feel like. (Note: Downloads do have an expiration and certain content, based on licensing, are made available for a limited time)
Services like Netflix also make access to content much easier. Subscribers have more options as well. Video rental stores were quite limited, based on the actual physical inventory that the store can hold. Streaming services have a database of so many titles and they are available, so no more need to worry about someone returning the DVD like in stores.
How does Netflix work?
In order to understand, you need to take a look at the Netflix network. It is one of the world’s most advanced ensemble of equipment along with a highly available network infrastructure. They store their content across a vast number of servers worldwide, with at least 10 servers near you. Everything must be kept running for 24x7x365 operations with downtime kept to zero or a minimum.
Their network engineers are demigods in the media industry for demonstrating an incredible feat back in June 2016. This was when Netflix ran a security test by performing a DDOS (Distributed Denial Of Service) attack against itself in order to gather insights to prevent them from happening in the future. The network engineers used the opportunity to identify where the network was vulnerable and find preventative measures to harden the system. Since then, their hardened network security has prevented significant attacks and they were also able to scale to handle millions of subscribers.
The Netflix network is truly capable of handling subscriber requests. They can handle up to 35 TB/sec of data, which is an insurmountable amount of requests for your average network. A typical DDOS attack would be like a drop of water in the ocean. Building the network required being able to scale to meet these loads along with implementing security to prevent and anticipate legitimate requests from those that are attacks.
Here are some of the numbers on Netflix (as of 2018 / Source: Statista):
$27.4B Worldwide Revenue (Annual)
148.46M Subscribers Worldwide
According to Variety Magazine, Netflix has streamed up to 250M hours of video on a single day back in January 2017. The average is 125M hours per day. This is expected to grow in the following years and that will surely put more pressure on the network.
The complexity of the infrastructure and relationships that runs the network is no simple task. Let us take a look at the network architecture. We will break it down to 6 parts in order to explain it more clearly.
1 — Content request made by subscriber
It all begins with an HTTP request for a movie or show, to a Netflix server. The HTTP request is sent out to the Internet via the ISP (Internet Service Provider) of the subscriber. Since not all subscribers are from the same region (they are spread out worldwide), Netflix has segregated its network to optimize it on a regional basis. The location of the subscriber must be identified based on their ISP’s “block address” and route them to the nearest server for optimal performance.
2 — Resolvers pass the request to the Netflix domain’s authoritative server
This basically means that a DNS lookup is initiated upon the HTTP request from the subscriber’s device. This is all part of the name resolution system used to connect to Netflix’s Internet domain, which is being served by a pool of servers. Think of it like looking up the “street address” of a place you want to visit. On the Internet, we have the same thing, only they are called an IP address. DNS helps to identify this by resolving it to a more user friendly name like netflix.com. Once the authoritative server answers the request, it directs the HTTP request to the appropriate server. For faster access, some servers already cache the server information.
3 — Requested content is retrieved from an index stored on a database
The server handles the request using a microservice architecture. These are software that run on the cloud, with Amazon’s AWS being a part of the system. This uses many applications that communicate with other applications in order to distribute tasks and resources. They communicate using what is called an API (Application Programming Interface). One service will handle the request and pass it on as a database query to another service, which will return the result. Once the result has been returned, another service will process it to retrieve the content.
4 — Content is pushed out from a storage location or accelerated service
Behind the scenes, Netflix has to process the content using advanced encoding techniques to optimize performance. The problem is that the Internet does not have a uniform data speed. Some countries networks are faster than others, so the content has to use ABR (Adaptive Bit Rate), typical implementation in OTT networks for compatibility with slower networks. Netflix uses Amazon’s S3 as part of it’s infrastructure when it comes to storage, and EC2 for transcoding and scaling. This works with other storage servers, where the content is copied to provide to subscribers. Accelerated services are on the edge networks of the ecosystem. They basically cache the most requested content for faster performance.
5 — Edge locations determine where to route the request to optimize content delivery
Earlier I mentioned about how Netflix uses regions. This is in order to optimize content delivery. This makes sure you don’t have to connect half way around the world when there is a closer server to your location. Once again, accelerated services are used to deliver the most watched content. Netflix actually installs their own devices at ISP locations worldwide to help accelerate content delivery. They deploy this with their Open Connect edge server devices along with global CDN (Content Delivery Network) partners like Akamai. The content before being delivered, in order to meet guidelines for copyright protection and security, is also encrypted to prevent illegal copying. Netflix uses a DRM (Digital Rights Management) on their system.
6 — The content is streamed to the subscriber
Now this is the tricky part. There is a plethora of devices out there, so for the best user experience, Netflix will have to make sure of compatibility e.g. tablets, smartphones, laptops, etc. Netflix has to be able to stream video on all supported devices. This is done in order to adjust the bit rate traffic. This reduces the need for more buffering, thus optimizing network throughput and bandwidth. The idea here is to be able to stream Full HD (1080p) to devices that support it, while adjusting to lower resolution on non-Full HD (720p). It must also be able to deliver UHD content to those who subscribe to premium services. Subscribers who have a fast Internet connection will be able to stream with little to no lag. An ideal connection is wired broadband > 3 Mbps or wireless 4G LTE (soon 5G).
Efficient Use of Bandwidth
What is required of streaming services is less buffering, ideally what subscribers want despite having poor or slow Internet connection. Netflix solves this problem using adaptive streaming based on ABR. Your content is delivered to you based on your network’s bandwidth. Thus, picture quality is adjusted dynamically from high resolution when the bandwidth is available and lower resolution when there is network congestion or high latency. If your peak data speed is 25 Mbps, common in many American states, then delivery of high resolution quality can be attained. Otherwise, the bit rate will adjust when the data speed is below 25 Mbps. The picture quality is still acceptable even with lower rates (e.g. 3 Mbps) but not below 1 Mbps. The Netflix devices optimize the delivery of content in the best way possible.
Netflix also uses H.264 High Profile and VP9 codecs largely to be able to reach more users for reliable streaming. These formats compress the video and thus allow better usage of bandwidth. Another format that will be deployed that is faster than current standards is called AV1, which other streaming services like Amazon Prime are planning to use.
Netflix also uses a preferred vendor program called NPV (Netflix Preferred Vendor). These are media and engineering partnerships that ensure that the device’s video playback is acceptable and the apps launch properly. This is to provide quality control of devices that work in the Netflix network ecosystem. This is one way to prevent poor performance so as to guarantee that a device meets the standards set forth by Netflix.
To Sum It All Up ….
When you play a movie or show to stream from Netflix, it undergoes a process that involves name resolution and microservices. It sets into motion a system of software that communicate with one another to retrieve and deliver the content you want to watch on your device. It all happens in the microseconds, and it is so fast we don’t notice it at all. What we do notice is lag, and that is what streaming services work hard to avoid. Next time you stream a video, even if it’s on YouTube or Vimeo, think of how complicated things are under the hood and there will be more appreciation to how the service works. Besides the content itself, that is what we value as subscribers.