Part 5 · Case Studies 📖 ১৪ মিনিট পড়া 📝 ২০টি কুইজ

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 করতে:

  1. Master file (raw)।
  2. Encoded multiple bitrate (240p, 480p, 720p, 1080p, 4K)।
  3. Each bitrate-এ multiple codec (H.264, H.265, AV1)।
  4. Multiple language audio।
  5. Subtitle (multi-language)।
  6. Each combination separate file → হাজার হাজার version।
  7. 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

  1. User behavior log (Kafka)।
  2. Batch processing (Spark) — model retrain।
  3. Real-time scoring।
  4. Cache top recommendations।
  5. A/B test continuously।

Playback Flow

  1. User movie click।
  2. Playback service consult — license check, geo-restriction।
  3. Manifest file (DASH/HLS) generate — chunk URLs সহ।
  4. Player nearest OCA-এর address পায়।
  5. Player chunks download — adaptive bitrate।
  6. Buffer maintain।
  7. 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

  1. Own your CDN if you can।
  2. Embrace failure (chaos engineering)।
  3. Microservice + DevOps maturity।
  4. Data-driven (A/B everything)।
  5. 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।