πŸ’¬
βœ‰οΈ
πŸ“Έ
▢️

Loading…

Design YouTube: video upload, transcoding, and CDN

YoutubeGuided Mode

CDN: Global Low-Latency Segment Delivery

The Streaming Service now returns CDN-fronted segment URLs instead of direct S3 URLs. The CDN caches segments at edge nodes worldwide β€” most viewers never touch S3.

Request Flow

1

Manifest returns CDN URLs

The master manifest now contains CDN-prefixed URLs: https://cdn.youtube.com/vi/abc/1080p/000.ts instead of s3://... The CDN handles all segment delivery.

2

CDN serves from edge

A viewer in Tokyo requests segment_001.ts. The CDN edge node in Tokyo has it cached β€” latency is <10ms vs 200ms from us-east-1. No S3 involved.

3

CDN misses β†’ origin fetch

On a cache miss (first viewer requesting a new video in a region), the CDN fetches from S3 origin once and caches locally. All subsequent viewers in that region get the cached copy.

Why We Need This

Without CDN, every one of YouTube's 2 billion viewers fetches segments from a handful of S3 regions. CDN reduces S3 load by 95%+ and reduces viewer latency from 200ms to <20ms globally.

Key Insight

Video segments are perfect CDN objects: immutable (a segment never changes after processing), content-addressed (hash as filename), and popular (thousands of viewers request the same segment). Cache hit rates above 90% are normal.

Step 8 of 9