· SWE Editorial · System Design · 6 min read
Design YouTube: System Design Interview Guide
A structured walkthrough of designing a video-sharing platform like YouTube for system design interviews, covering upload pipelines, transcoding, CDN delivery, and recommendations.
“Design YouTube” is a system design interview staple because it touches nearly every hard problem in distributed systems: massive unstructured data (video), global content delivery, real-time metadata updates, and personalized ranking. This guide gives you a structure for tackling it under interview time pressure.
Clarifying Scope
Don’t try to design all of YouTube in 45 minutes — no interviewer expects that. Narrow the scope out loud:
- Are we focusing on upload and playback, or also on recommendations and comments?
- What scale should we design for? A reasonable target: 500 hours of video uploaded per minute, billions of views per day.
- Is live streaming in scope, or just video-on-demand (VOD)? (Usually VOD first; live streaming is a common follow-up or a separate question — see our companion article on scaling bottlenecks.)
- Do we need to design search and recommendations in depth, or just acknowledge they exist?
A typical scoped-down version: design the upload pipeline, storage, transcoding, and playback/CDN delivery, with recommendations discussed at a high level.
Functional and Non-Functional Requirements
Functional:
- Users can upload videos in various formats/resolutions.
- Users can watch videos, ideally with adaptive quality based on their network.
- The system must generate a personalized homepage/recommendation feed.
Non-functional:
- High availability for playback (video is the core product; downtime is unacceptable).
- Low latency to start playback (sub-second to a couple seconds).
- Massive storage scalability (video files are enormous compared to typical web data).
- Cost efficiency, since storage and bandwidth dominate the cost structure at this scale.
The Upload Pipeline
When a creator uploads a video, the naive approach — accepting the full file directly into a single API server — breaks immediately at scale. The interview-quality answer:
- Client requests a pre-signed upload URL from the API service.
- Client uploads the raw video directly to blob storage (S3 or equivalent), often via chunked/resumable upload so a dropped connection doesn’t restart the whole upload.
- Once upload completes, an event fires (via the storage system’s event notifications) into a message queue.
- A transcoding pipeline picks up the event and begins processing.
This design keeps the API layer stateless and thin — it never touches the actual video bytes, only metadata and pre-signed URLs.
Transcoding: The Hardest Part of the System
Raw uploaded video is rarely in a format suitable for direct playback across every device and network condition. Transcoding converts the source file into multiple resolutions (1080p, 720p, 480p, 360p) and formats/codecs, generating what’s needed for adaptive bitrate streaming (e.g., HLS or DASH manifests plus segmented video files).
Key design points to raise:
- Parallelization. A single long video can be split into chunks and transcoded in parallel across a worker fleet, then reassembled, dramatically reducing wall-clock processing time for long uploads.
- Worker queue architecture. A message queue (Kafka, SQS) decouples upload completion from transcoding capacity — workers pull jobs at their own pace, and the queue absorbs bursts.
- Priority tiers. Not all uploads need equal urgency; a creator with a scheduled premiere might get priority processing over a random home video.
- Cost tradeoff. Transcoding is CPU/GPU-intensive and expensive at scale. Pre-computing every possible resolution for every video wastes resources on rarely-watched content; some systems defer transcoding of lower-priority resolutions until first request (lazy transcoding), trading a bit of first-view latency for large compute savings.
CDN Delivery: Getting Bits to Viewers Fast
Once transcoded, video segments are pushed to a CDN (content delivery network) with edge nodes distributed globally. This is non-negotiable at YouTube’s scale — serving billions of video-hours from origin servers would be both slow and prohibitively expensive.
- The client’s video player requests the adaptive bitrate manifest, then fetches segments from the nearest edge node.
- The player continuously monitors network throughput and switches resolution tiers dynamically (this is what makes video “adapt” to a spotty connection).
- Origin storage (the durable copy) is only hit on a CDN cache miss, which should be rare for popular content but common for the “long tail” of rarely-watched videos.
The Recommendation Engine (High-Level)
A full recommendation system design is often a separate interview question, but you should be able to sketch the shape of it:
- A candidate generation stage narrows billions of videos down to a few hundred relevant candidates per user (often collaborative filtering or embedding-based nearest-neighbor lookup).
- A ranking stage scores those few hundred candidates using a richer model (watch history, click-through rate, session context) and returns the final ordered list.
- This two-stage funnel exists because running a heavy ranking model against every video in the catalog for every user request is computationally infeasible.
Comparison of Design Choices
| Component | Naive Approach | Production-Grade Approach | Why It Matters |
|---|---|---|---|
| Upload | Client sends full file to API server | Pre-signed URL, direct-to-blob-storage upload | API servers stay stateless and don’t bottleneck on large file I/O |
| Transcoding | Transcode entire video in one worker | Chunked, parallelized transcoding across worker fleet | Cuts processing time for long videos from hours to minutes |
| Delivery | Serve video directly from origin storage | CDN with edge caching + adaptive bitrate | Reduces latency and origin load by orders of magnitude |
| Metadata storage | Single relational DB for everything | Relational DB for structured metadata + separate systems for view counts, comments | Avoids write contention on hot counters |
| Recommendations | Score every video for every user | Two-stage candidate generation + ranking funnel | Makes personalization computationally feasible at scale |
Common Pitfalls
- Treating video like any other file upload. Interviewers want to see that you understand video’s unique constraints: size, need for transcoding, and adaptive streaming.
- Skipping the “why CDN” explanation. Just saying “we’ll use a CDN” without explaining edge caching and cache-miss behavior leaves points on the table.
- Ignoring metadata vs. blob storage separation. Video bytes live in blob storage; titles, descriptions, view counts, and comments live in a separate, more traditional database layer. Conflating the two is a common junior mistake.
- Not addressing the thundering herd problem for suddenly-viral videos — worth a one-line mention here, covered in depth in our scaling bottlenecks article.
A Clean Interview Narrative
A strong answer moves through: scope clarification, functional/non-functional requirements, the upload pipeline (pre-signed URLs, direct-to-blob), the transcoding pipeline (queue-based, parallelized, adaptive bitrate output), CDN-based delivery, a brief sketch of the two-stage recommendation funnel, and closes by flagging scaling concerns like viral-video hot-spotting for further discussion if time allows.
Further Reading
For a repeatable framework you can apply to this and dozens of other prompts, see The 0-to-1 SWE Interview Playbook (Amazon: https://www.amazon.com/dp/B0H256Z1MF?tag=sirjohnnymai-20). It’s structured around exactly this kind of scope-first, component-by-component approach, so you walk into any system design round with a repeatable process instead of hoping you remember the right diagram.
Once you’re comfortable with this high-level shape, dig into our companion pieces on YouTube’s architecture and data flow, and on the specific scaling bottlenecks that come up as follow-up questions once the interviewer probes deeper.