NetflixDifficulty: Advanced
How Netflix Works: CDN & Microservices Architecture
Netflix serves billions of hours of streaming video globally. It utilizes AWS for computing and its own Open Connect CDN for video delivery, shifting towards an event-driven microservices architecture.
High-Level Architecture
[User] -> (API Gateway) -> [Microservices (Auth, Discovery, Playback)]
[User] -> (Open Connect CDN) -> [Video Stream]Database Design
Uses Cassandra for heavy write/read operations (like viewing history) and CockroachDB for transactional data. Media metadata is stored in MySQL and indexed in ElasticSearch.
Caching Strategy
EVCache (based on Memcached) caches almost all API responses, dramatically reducing database load.
Scaling & APIs
Scaling: Global distribution using AWS multi-region setups. Control plane handles authentication and browsing; data plane (Open Connect) handles raw video delivery directly from ISPs.
API Design: GraphQL federation allows client apps to request exactly the UI data they need across hundreds of backend microservices.
Real-World Challenges
- •Encoding video into dozens of formats and bitrates.
- •Predictive caching: pushing video files to ISP servers before users even hit play.
- •Graceful degradation when a non-critical microservice (like recommendations) fails.