Case Study: Netflix
Internet-এর ৩৫% bandwidth Netflix — কীভাবে?
Netflix peak time-এ internet-এর ১৫-৩৫% bandwidth use করে। ২০০+ million subscriber, ১৯০+ country, প্রতিদিন billion+ hour viewing। এই scale handle করার engineering — system design-এর masterclass।
Requirements
Functional
- Video streaming (multiple devices, qualities)।
- Browse + search content।
- Personalized recommendation।
- User profile, watch history।
- Subscription, billing।
- Multi-device sync।
Non-Functional
- Low latency, smooth playback।
- High availability (99.99%+)।
- Adaptive quality।
- Global delivery।
- Massive bandwidth।
Capacity Estimation
Subscribers: 250M
Concurrent viewers (peak): 50M
Avg bitrate: 4 Mbps
Total bandwidth: 50M × 4 Mbps = 200 Tbps
Storage:
Movies: 30,000+ titles
Encoded versions: 1000s per title (different bitrates, languages)
Multi-PB total
Architecture Overview
[User Device]
↓
[Edge CDN — Open Connect Appliance (OCA)]
↓ (cache miss)
[AWS Origin]
[Microservices on AWS]
↓
[Storage]: S3 (master), Cassandra, MySQL
[Recommendation]: Spark, ML pipeline
[Analytics]: Kafka → S3 → Redshift
Netflix Open Connect (CDN)
Netflix-এর নিজস্ব CDN — ১০০+ ISP-এর সাথে partnership।
Open Connect Appliance (OCA)
- Server hardware ISP-এর data center-এ install।
- Free for ISP — Netflix থেকে।
- Pre-popular content cache।
- User-এর কাছে network-এ short hop।
কেন কাজ করে
- Bangladesh ISP-এর OCA থাকলে — Netflix content local।
- Latency কম, ISP-এর external bandwidth save।
- Viewing pattern predictable (popular show peak hour-এ)।
Video Encoding Pipeline
একটি 4K movie ingest করতে:
- Master file (raw)।
- Encoded multiple bitrate (240p, 480p, 720p, 1080p, 4K)।
- Each bitrate-এ multiple codec (H.264, H.265, AV1)।
- Multiple language audio।
- Subtitle (multi-language)।
- Each combination separate file → হাজার হাজার version।
- Encoded files OCA-তে push।
Adaptive Bitrate Streaming (HLS/DASH)
- Video chunks (e.g., 10-second segments)।
- Each chunk multiple quality।
- Player network-অনুযায়ী quality select।
- Network slow → automatically lower quality।
Microservices Architecture
Netflix microservice pioneer — 700+ services।
- Account, billing, subscription।
- Catalog, metadata।
- Search, recommendation।
- Playback, encoding।
- Analytics, A/B testing।
Open-source contributions
- Eureka: Service discovery।
- Hystrix: Circuit breaker (deprecated)।
- Zuul: API Gateway।
- Spinnaker: CD platform।
- Chaos Monkey: Chaos engineering।
Recommendation System
Netflix-এর secret sauce — 80% viewing recommendation থেকে।
Approaches
- Collaborative filtering: Similar user-এর preference।
- Content-based: Movie attribute (genre, actor) match।
- Deep learning: Neural network।
- Contextual: Time of day, device, mood।
Pipeline
- User behavior log (Kafka)।
- Batch processing (Spark) — model retrain।
- Real-time scoring।
- Cache top recommendations।
- A/B test continuously।
Playback Flow
- User movie click।
- Playback service consult — license check, geo-restriction।
- Manifest file (DASH/HLS) generate — chunk URLs সহ।
- Player nearest OCA-এর address পায়।
- Player chunks download — adaptive bitrate।
- Buffer maintain।
- Watch position periodically save।
Cloud-Native (AWS)
Netflix all-in on AWS:
- EC2 — compute।
- S3 — master storage।
- DynamoDB — state।
- Cassandra — viewing history (custom multi-region)।
- EMR — data processing।
Multi-region active-active।
Chaos Engineering
Netflix Chaos Monkey + suite:
- Chaos Monkey: Random instance kill।
- Latency Monkey: Inject latency।
- Chaos Kong: Whole region fail।
- Goal: Production resilience verify।
A/B Testing
Everything A/B test:
- Thumbnail image।
- Title placement।
- Recommendation algorithm।
- UI element।
Data-driven decision।
Trade-offs
- Microservice complexity vs scalability।
- Encoding storage vs adaptive quality।
- Recommendation accuracy vs compute cost।
- OCA hardware cost vs ISP partnership benefit।
Engineering Lessons
- Own your CDN if you can।
- Embrace failure (chaos engineering)।
- Microservice + DevOps maturity।
- Data-driven (A/B everything)।
- Cloud-native, multi-region।
📌 চ্যাপ্টার সারমর্ম
- Netflix = Open Connect CDN + AWS microservices।
- Adaptive bitrate (HLS/DASH) — network-aware।
- 700+ microservices — DevOps mature।
- Recommendation 80% viewing drive।
- Chaos engineering — resilience built-in।