Amazon sits behind the huge portion of the internet and same is with Netflix. It dominates server side computers that make internet work.
When you click on the play button, while watching some videos on your phone or computer, it’s not just your computer doing some work as there’s another computer somewhere out in the world that is sending video over to you by playing along with you from hundreds of miles away.
Plenty of those computers are run by amazon. You only see them when you look at the big picture.
So, what do these computers look like? Let us have a visual of these computers.
In the year 2000, the company Blockbuster LLC had an opportunity to buy Netflix for a mere $50 million. But in 2016, Netflix made a comeback and accumulated $8.83 billion in revenue. One would wonder how a company which was worth $50 million in 2000 is now worth around $87 billion. A layman would guess that the company had a continual impressive growth over 17 years straight. But the fact is that within this time period, in 2008, Netflix was a victim of a major database corruption.
How Netflix became a billion-dollar titan?
Back in 2008, Netflix was majorly working on DVD-by-mail service. Due to the above-mentioned database corruption incident, DVD shipping was disrupted for three days. Netflix management decided to move to the cloud, away from relational systems in their data centers. The cloud services of AWS (Amazon Web Services) offered the company the ability to scale as much as they needed.
Netflix had chosen AWS cloud to migrate its IT infrastructure because AWS could offer highly reliable databases, large-scale cloud storage, and multiple data centers around the globe. By utilizing the cloud infrastructure built and maintained by AWS, Netflix did not do the undifferentiated heavy lifting work of building data centers, but focused more on its core business of providing high quality video streaming user experience.
How does the actual architecture of Netflix work?
From the software architecture perspective, Netflix comprises three main parts: Client, Backend and Content Delivery Network.
What is a client?
Client is any supported browser on a laptop, desktop, a Netflix app on smartphones, or even smart TVs. Netflix develops its own iOS and Android apps to provide the best viewing experience to each and every client. By controlling their apps and other devices through its SDK, Netflix can adapt its streaming services transparently under certain circumstances such as slow networks or overloaded servers.
Open Connect CDN is a network of servers called open connect Application optimized for storing and streaming large videos. So, Netflix uses OCAs to stream videos directly to clients.
While streaming video, if you have low connectivity then Client App intelligently lowers the video quality or switches to different OCA servers if network connections are overloaded or have errors. Even if the connected OCA is overloaded or failed, Client App can easily change to another OCA server for better viewing experience. Everything could be achieved easily because the Netflix Platform SDK on client keeps tracking all the latest healthy OCAs that are retrieved from Playback Apps service.
AWS Backend services used by Netflix
Backend includes services, databases, and storages running entirely on AWS cloud. Backend basically handles everything not involving streaming videos.
- Scalable computing instances (AWS EC2)
- Scalable storage (AWS S3)
- Business logic microservices (purpose-built frameworks by Netflix)
- Scalable distributed databases (AWS DynamoDB, Cassandra)
- Big data processing and analytics jobs (AWS EMR, Hadoop, Spark, Flink, Kafka and other purpose-built tools by Netflix)
- Video processing and transcoding (purpose-built tools by Netflix)
What is an Application API?
Application APIs are defined under three categories:
- Signup API for non-member requests such as sign-up, billing, free trial, etc.
- Discovery API for search, recommendation requests.
- Play API for streaming, view licensing requests.
How does API Gateway Service work?
API Gateway Service component communicates with AWS Load Balancers to resolve all the requests from clients. This component can be deployed to multiple AWS EC2 instances across different regions to increase Netflix service availability. The diagram in the below figure represents an open-sourced Zuul, an implementation of API Gateway created by Netflix.
Netflix uses AWS for nearly all of its computing and storage needs, including databases, analytics, recommendation engines, video transcoding, and more. Hundreds of functions in total use more than 100,000 server instances on AWS.
When Netflix subscribers click the Play button on their apps or devices, the Client will talk to both Backend on AWS and OCAs on Netflix CDN to stream videos. Let us have a look at the working of the playback process.
How Netflix stores their PBs of data?
Netflix makes use of different data stores, both SQL and NoSQL, for different purposes to store their PBs of data.
- MySQL: Movie title management and transactional/billing purposes
- Hadoop: Big data processing based on user logs
- ElasticSearch: Powered searching titles for Netflix apps
Cassandra is a distributed column-based NoSQL data store to handle large amounts of read requests with no single point of failure. Cassandra is used for optimizing the latency over large write requests because of its eventually consistent ability.
Backbone Of Netflix business
Stream Processing Data Pipeline has become Netflix’s data backbone of business analytics and personalized recommendation tasks. It is responsible for producing, collecting, processing, aggregating, and moving all microservice events to other data processors in near real-time.
Most important design goals of Netflix
- High Availability
- Low Latency
“Amazon Kinesis Streams processes multiple terabytes of log data each day, yet events show up in our analytics in seconds. We can discover and respond to issues in real time, ensuring high availability and a great customer experience.”John Bennett (Senior Software Engineer, Netflix)
The internet-based services enabling remote work and play have experienced unprecedented growth because of Covid-19 restrictions. Netflix’s new subscriber growth increased by 47 percent over the past month. This blog can serve as a reference implementation of how a typical production system of Netflix should be built.