Design the architecture for YouTube - the world's largest video platform with 2.5 billion monthly users watching 1 billion hours of video per day. Your design must cover:
- Video upload & transcoding - creators upload videos up to 12 hours long and 256 GB in size. Each video is transcoded into 20+ resolution/bitrate/codec combinations (360p to 8K, H.264/VP9/AV1). Transcoding must complete within 2 hours of upload.•Adaptive bitrate streaming - the player uses DASH/HLS to switch quality in real time based on the viewer's bandwidth. Segment duration: 2-6 seconds.•Content delivery - videos are served from a global CDN with thousands of edge locations. Popular videos are pre-cached at the edge; long-tail videos are served from origin.•Recommendation engine - the home feed and "Up Next" sidebar are powered by a deep learning model trained on watch history, engagement, and content features. Low-latency inference (< 200 ms) is critical.•Search - search across billions of videos by title, description, transcript (auto-generated via speech-to-text), and metadata.•Comments & engagement - threaded comments, likes/dislikes, subscriptions. Handle viral videos with millions of concurrent viewers.•Monetization - ad insertion (pre-roll, mid-roll) with real-time auction (ad bidding) for every video view.
This is one of the hardest system design problems due to the combination of massive storage, heavy compute, and real-time streaming at global scale.
Design YouTube's video platform - upload, transcode, adaptive streaming, recommendations, and comments at planetary scale. Build this architecture under realistic production constraints, then validate tradeoffs in the design lab simulation.
Request path: The solution keeps ingress, service logic, and stateful dependencies separated so each layer can scale independently.
Reference flow: Web Clients -> DNS -> CDN Edge -> Load Balancer -> API Gateway -> Core Service -> Primary SQL DB -> Redis Cache