|11. Case Study: YouTube Design करा
Chapter 11System Design~1 min read

Case Study: YouTube Design करा

Video Streaming System

"Design YouTube" किंवा "Design Netflix" — हे video streaming system design प्रश्न आहेत. Video upload, processing, storage, adaptive streaming — हे सगळं कसं काम करतं ते बघू.

Requirements

YouTube-like system requirements

text
Functional:
✓ Video upload करा
✓ Video watch करा (streaming)
✓ Search videos
✓ Like, comment, subscribe
✓ Recommendations

Non-functional:
✓ 500 hours of video uploaded every minute
✓ 1 billion hours watched daily
✓ Low buffering: smooth 4K streaming
✓ 99.9% availability
✓ Worldwide — global low latency

Video Upload Pipeline

Video processing pipeline

text
User uploads video
     ↓
[Upload Service] → Raw video → [Object Storage (S3)]
                                      ↓
                              [Message Queue (Kafka)]
                                      ↓
                          [Video Processing Workers]
                           ↓         ↓         ↓
                     Transcoding  Thumbnail  Metadata
                     (FFmpeg)     Generation  Extraction
                         ↓
                 Multiple Formats & Resolutions:
                 360p, 480p, 720p, 1080p, 4K
                         ↓
                  [CDN Distribution]
                  (Cloudflare/Akamai)
                         ↓
                 User watches — nearest CDN edge

Adaptive Bitrate Streaming (ABR)

YouTube automatically तुमच्या internet speed नुसार video quality adjust करतो. Fast internet → 1080p, slow internet → 360p. हे Adaptive Bitrate Streaming (HLS/DASH protocol) ने होतं.

  • Video multiple qualities मध्ये transcode होतो (360p, 720p, 1080p, 4K)
  • Small chunks (2-10 seconds) मध्ये split होतो
  • Player bandwidth monitor करतो, quality automatically switch करतो
  • Buffer कमी झाला → lower quality, bandwidth वाढला → higher quality
  • HLS (Apple) आणि DASH (open standard) — दोन्ही protocols वापरतात

Video Storage

  • Raw + processed videos: Object Storage (AWS S3, Google GCS) — cheap, durable
  • Metadata (title, description, tags): SQL Database (MySQL)
  • View counts, likes: Eventually consistent (Redis + periodic DB sync)
  • Search index: Elasticsearch
  • CDN: Akamai, Cloudflare — edge caching, worldwide delivery

Key Points — लक्षात ठेवा

  • Video upload: async processing via message queue
  • Transcoding: FFmpeg — multiple resolutions
  • ABR: bandwidth नुसार quality auto-adjust
  • Object Storage: S3/GCS — cheap video storage
  • CDN: worldwide low-latency delivery
0/11 chapters पूर्ण