Design YouTube: the video streaming system design walkthrough
The request to design YouTube sounds like a two-table CRUD app — upload a file, save it, let people press play. For one video and one viewer that is exactly what it is. But the interview asks you to do it for a billion viewers watching on everything from a gigabit fibre line to a phone on a dropping 3G signal, with playback that starts in under two seconds and never buffers if it can help it — and that is a delivery and encoding problem, not an upload form. This is one of the most common video streaming system design prompts because the one-line brief hides a transcoding pipeline, a global CDN, and a read path that is thousands of times heavier than the write path.
The round turns on two realities. First, the file a creator uploads is almost never the file a viewer plays: it must be re-encoded into a ladder of resolutions and bitrates so the player can switch on the fly as the network changes. Second, when you design a video streaming service at this scale, the bytes do not flow from your servers at all — they flow from edge caches close to the viewer, and your job is to keep the right segments warm in those caches. This walkthrough follows the path a strong candidate draws on the whiteboard — requirements, estimate, API and data model, high-level design, then the deep dives — and at each step it names the follow-up the interviewer uses to tell a memorised answer from an engineer who understands the tradeoff.
How the video streaming round is actually run
A video streaming round runs about 60 minutes on a shared canvas — you draw the boxes and arrows while you talk, and the interviewer interrupts. It is a favourite because the one-line problem opens onto deep water fast: the moment you write "store the video and stream it," the question becomes in what formats, from where, and how does playback adapt when the network changes — and every answer after that (transcoding, packaging, CDN, adaptive bitrate) compounds. Get the transcode pipeline and the delivery path clean and you have shown the whole system in one problem.
The interviewer rarely lets "upload the file and serve it back" stand. "The viewer is on a train, their bandwidth drops to almost nothing mid-video — what happens to their playback?" That question — graceful degradation under a design that is otherwise just a file server — is the one a copied answer can never rehearse, and the one this round is really testing.
The rounds here are modelled on how the loop runs, not scraped from any candidate's recall. What matters for prep is the shape: a blank canvas, a clock, and a follow-up after every decision you make.
The five-step framework for any HLD round
Every high-level design answer fits the same spine. Say it out loud at the start so the interviewer knows you have a plan, then walk it:
- Clarify requirements — functional and non-functional, and what you are explicitly not building.
- Estimate — uploads, storage and read:write ratio, to justify every later choice.
- High-level design — the boxes and arrows: client, upload service, blob store, transcoding pipeline, CDN, player.
- Deep dive — the two or three decisions that actually decide this system.
- Follow-ups — bottlenecks, failure modes, and what you would change at ten times the scale.
What the debrief measures
The score is not "right or wrong design." A good HLD debrief reads on four dimensions, and every move below maps to one: problem solving (did you make the transcode pipeline chunked so it parallelises, and the view count asynchronous so a viral spike cannot melt the database), communication (did you say why you serve from a CDN and not from origin in a sentence), technical execution (ABR with an HLS/DASH manifest, segment caching at the edge, an approximate-then-reconcile view counter), and time management (did you spend your 60 minutes on transcoding and delivery, not on the upload button). Reading a walkthrough teaches the design; it does not teach you to deliver it on the clock while someone pushes back.
Step 1 — Requirements: what YouTube must do
Spend the first few minutes here. Jumping to boxes before you have scoped the problem is the fastest way to design the wrong system.
| Type | Requirement |
|---|---|
| Functional | Upload a video; transcode it into multiple resolutions and bitrates; store it durably; stream it on demand to any device; let viewers see a view count; show basic metadata (title, channel, thumbnail). |
| Functional (optional) | Search, recommendations, comments, likes, subscriptions, live streaming — name them, then scope them out so you can go deep on upload-transcode-deliver. |
| Non-functional | Massive read scale (reads dwarf writes by orders of magnitude); low startup latency (playback begins in ~1–2s); high availability and durability (an uploaded video is never lost); global reach (viewers on every continent and every network speed). |
The sentence that earns points: "The upload is the easy part — the system is really a transcoding pipeline feeding a global CDN, and the read path is thousands of times heavier than the write path." Say that and you have framed the entire design before drawing a box.
Step 2 — Capacity estimation (back of the envelope)
Estimation here is about proving one thing: the hard axis is transcoding and CDN delivery on a read-heavy workload, not the upload throughput.
| Quantity | Assumption | Result |
|---|---|---|
| Upload rate | ~500 hours of video uploaded/min | a continuous, write-heavy transcode queue, not a spike |
| Read:write ratio | views vastly outnumber uploads | ~1000:1 or higher → the system is a read/delivery system |
| Storage | raw + every rendition, retained | petabytes, growing forever → object storage, tiered by popularity |
| Egress | every view streams segments | dominated by the CDN, not origin → bandwidth lives at the edge |
Two conclusions fall out, and you should say both out loud. First, this is a read-and-deliver system — the write path (upload) is a steady queue you can process offline, but the read path serves orders of magnitude more traffic, so it must be cached at the edge and never hit origin for a popular video. Second, the transcode is the expensive write-time work — one upload fans out into many renditions, so you parallelise it rather than encode a two-hour film on one machine. You have now pointed the interview at the real deep dives before anyone asked.
Step 3 — API and data model
Two interfaces matter: the upload path (client → your servers) and the playback path (player → manifest → CDN). The tables hold metadata and view state; the video bytes live in object storage.
| Endpoint | Operation |
|---|---|
POST /videos → upload_url
|
request a resumable, chunked upload (a presigned URL into blob storage) |
PUT {upload_url} (chunked) |
upload raw bytes in resumable chunks, so a dropped connection resumes, not restarts |
GET /videos/{id} → manifest_url + metadata
|
fetch the HLS/DASH manifest URL and title/channel/thumbnail for playback |
POST /videos/{id}/view |
record a view event (fire-and-forget, aggregated asynchronously) |
The data model is thin — most of the system's weight is in object storage and the CDN, not the database:
| Entity | Notes |
|---|---|
video_metadata |
video_id, title, channel_id, status (uploaded/transcoding/ready), duration, thumbnail_url, created_at. |
rendition |
video_id, resolution, bitrate, codec, segment_path — one row per rendition in the bitrate ladder. |
manifest |
the HLS/DASH playlist that lists every rendition and its segments, so the player can pick and switch. |
view_store |
an append-only stream of view events plus a view_count per video, aggregated in batches. |
Step 4 — High-level design: upload, transcode, deliver
Now the boxes. The system splits cleanly into a write path that prepares the video and a read path that delivers it. Draw them as two flows meeting at object storage:
- Client → Upload service → raw blob store: the client requests a presigned, chunked/resumable upload and pushes the raw file straight into object storage — the upload service never buffers the whole file.
- Transcoding pipeline: triggered when the raw upload lands; it splits the video into chunks, encodes each chunk into every rung of the bitrate ladder (e.g. 240p → 1080p → 4K) in parallel, then packages the renditions into HLS/DASH segments and writes a manifest.
- Object storage → CDN: the transcoded segments and manifest are stored once and pushed out to CDN edge nodes close to viewers.
- Player → manifest → CDN: the player fetches the manifest, then streams segments from the nearest edge, switching renditions on the fly — adaptive bitrate streaming.
- Metadata DB + view pipeline: a metadata service answers "what is this video" and a separate asynchronous pipeline counts views without touching the playback path.
Say explicitly that the bytes never flow from origin for a popular video — the write path prepares segments once, and every view after that is served from the edge cache. Naming that split (prepare once, deliver many times, from the edge) unprompted is a signal the interviewer is listening for.
Deep dive: the video transcoding pipeline
This is the first decision that actually decides the round. A naive design transcodes the whole file on one worker — a two-hour 4K upload would take hours and pin a machine the entire time, and if that worker dies at 90% you start over. The senior answer chunks the video and treats transcoding as a parallel pipeline.
| Stage | What it does | Why it exists |
|---|---|---|
| Split | break the raw video into short segments (a few seconds each) at keyframe boundaries | So each chunk can be encoded independently, in parallel, on a different worker. |
| Encode (fan-out) | for every chunk, encode it into every rung of the bitrate ladder — a DAG of independent encode jobs | So one upload becomes many renditions fast, and a failed chunk is just one small job to retry. |
| Package & stitch | assemble the encoded chunks into per-rendition HLS/DASH segments and write the manifest | So the player gets a single playlist describing every rendition and its segments. |
The win is threefold: parallelism (hundreds of chunks encode at once instead of one long serial job), fault tolerance (a crashed worker re-runs one chunk, not the whole film), and faster time-to-ready (short videos can start publishing early renditions while longer work continues). Chunk-level encoding is why a long upload can be "ready" in minutes, not hours.
"Why transcode in chunks instead of just encoding the whole file?" Chunking turns one long serial job into hundreds of parallel ones, so a two-hour video is ready in minutes; and when a worker dies you retry a three-second chunk, not the entire encode. Name both the speed and the fault-tolerance half.
System Design
HLD · Media & analytics · 60 min
Design the transcoding pipeline out loud, with follow-ups
Deep dive: adaptive bitrate streaming and CDN delivery
This is the decision most candidates under-think. The online path looks easy — "the player downloads the video" — but the follow-ups are always "what happens when the network changes?" and "where do the bytes actually come from?"
Adaptive bitrate streaming (ABR). The player never downloads one fixed-quality file. It fetches a manifest (HLS .m3u8 or DASH .mpd) that lists every rendition in the ladder, each cut into short segments. The player downloads a few seconds at a time, measures the throughput it just got, and picks the next segment's quality to match — stepping down to 480p when bandwidth drops so playback keeps running, stepping back up when it recovers. Buffering becomes a rare worst case, not the default, because the player degrades quality instead of stalling.
CDN delivery. Those segments are served from CDN edge nodes, not your origin. A viewer requests the nearest edge; if the segment is cached there (a cache hit) it never touches your servers. The whole read path lives or dies on the cache-hit ratio — a popular video should be served almost entirely from the edge. For a known-viral release you pre-warm the popular renditions into edge caches before the traffic arrives, so the first million viewers already hit a warm cache.
Hot vs. long-tail. Popular videos stay hot at the edge; the long tail is fetched from origin on a cache miss and cached on the way out. Tier storage by popularity so you are not paying premium egress for videos nobody watches.
"The user is on mobile and their bandwidth drops mid-video — what happens?" ABR notices the lower throughput on the last segment and switches the next segment down to a lower rendition, so playback continues at reduced quality instead of buffering; it steps back up when the network recovers. Say the measure-then-switch loop, not just "it lowers quality."
System Design
HLD · Media & analytics · 60 min
Defend adaptive streaming and CDN caching out loud
Deep dive: view counts at scale and the read path
Scale changes the shape of the counter. A single UPDATE videos SET views = views + 1 per play is fine for a small site and a disaster for a video that goes viral — millions of writes a second to one hot row will melt the database. The senior answer makes the count asynchronous and approximate, then reconciled.
| Concern | Naive | Scaled |
|---|---|---|
| Write path | synchronous +1 on a hot row per view |
emit a view event to a stream (Kafka) and return immediately; playback never waits on the counter. |
| Aggregation | count rows on read | stream-aggregate events in small time windows and increment a cached counter in batches, flushing to the DB periodically. |
| Hot videos | one row, one lock | show an approximate count from cache (updated every few seconds) and reconcile the exact total offline — viewers do not need the number to be exact to the unit. |
The same "serve from cache, reconcile in the background" idea runs the whole read path: video metadata (title, channel, thumbnail) is cached hard because it is read constantly and changes rarely, so a play request resolves metadata from cache and segments from the CDN, and almost never touches the primary database. Repeat the real axis out loud: at this scale, nothing on the hot read path writes synchronously to a single row — counts are batched, metadata is cached, and bytes come from the edge.
"A new video goes viral — how does your view count not melt the database?" View events go onto a stream and are aggregated in windows, so the database sees batched increments, not millions of per-view writes; viewers see an approximate count from cache that is reconciled to the exact total offline. Name the stream, the batching, and the approximate-then-reconcile step.
The follow-ups that decide the video streaming round
Scan the probes from each deep dive and they rhyme. Master these five and you are ready for a version of the question that is not drawn exactly like this one.
- "Why transcode in chunks instead of the whole file?" → Parallelism (hundreds of chunks encode at once) and fault tolerance (retry one chunk, not the whole film). (problem solving)
- "Bandwidth drops mid-video — what happens?" → ABR measures the last segment's throughput and switches the next segment to a lower rendition, so playback continues instead of buffering. (technical execution)
- "Where do the bytes actually come from at scale?" → CDN edge nodes on a cache hit, not origin; the read path lives on the cache-hit ratio, and popular renditions are pre-warmed. (communication)
- "A video goes viral — how does the view count not melt the database?" → View events to a stream, aggregated in windows, batched increments, an approximate cached count reconciled offline. (problem solving)
- "What's the real bottleneck at scale?" → Not the upload — transcoding compute (parallelise it) and CDN delivery / cache-hit ratio on the read path. (technical execution)
Each maps to a debrief dimension. Reading this list teaches you the answers; it does not teach you to deliver them while someone interrupts — that only comes from saying them out loud.
How to prepare: a one-week plan
You do not need fifty systems. You need this one cold and the framework automatic, so the next "design X" is just new nouns in the same five steps.
- Days 1–2: Learn the five-step framework until it is reflex. Do YouTube end to end on paper — requirements, estimate, data model, the upload → transcode → store → CDN → player flow.
- Days 3–4: Drill the transcoding deep dive: chunking, the parallel encode fan-out across the bitrate ladder, packaging into HLS/DASH, and why chunk-level encoding wins on speed and fault tolerance. Say each tradeoff in one sentence.
- Days 5–6: Own delivery and counts — adaptive bitrate streaming, CDN edge caching and the cache-hit ratio, pre-warming, and the asynchronous approximate-then-reconcile view counter. Answer each of the five follow-ups out loud.
- Day 7: A full timed 60-minute round, narrating the whole way, with someone (or something) interrupting. This is the rep that counts.
This post is the deep walkthrough behind one row of the broader Top 25 system design interview questions — once YouTube is automatic, the same spine carries the rest of the list.
Frequently asked questions
How do I design YouTube step by step?
Follow the five-step HLD framework. Clarify requirements (upload, transcode to multiple resolutions, store, stream on demand, view counts, and scope out search and recommendations); estimate to show the system is read-heavy and delivery-bound, not upload-bound; define the upload and playback APIs plus the video metadata, rendition, manifest and view tables; draw the two flows (upload → raw blob store → transcoding pipeline → object storage → CDN → player, with a separate metadata and view pipeline); then deep-dive the decisions that matter — the transcoding pipeline, adaptive bitrate streaming with CDN delivery, and view counts at scale. Finish on the follow-ups about viral spikes and the real bottleneck.
Why does YouTube transcode a video into multiple resolutions?
Because viewers watch on wildly different devices and networks, and no single file fits all of them. Transcoding re-encodes the upload into a ladder of resolutions and bitrates — from a low rung for a weak mobile connection to a high rung for a fast wired one. The player then uses adaptive bitrate streaming to pick the rung that matches the bandwidth it is currently measuring, stepping down to keep playback smooth when the network drops and back up when it recovers. Without the ladder, a viewer on a slow connection would just buffer.
What is adaptive bitrate streaming (ABR)?
Adaptive bitrate streaming lets the player change video quality mid-playback as the network changes. The server provides a manifest (HLS or DASH) listing every rendition in the bitrate ladder, each split into short segments. The player downloads a few seconds at a time, measures the throughput it just achieved, and chooses the next segment's quality to match — so when bandwidth drops it switches to a lower rendition and keeps playing instead of stalling, and when bandwidth recovers it switches back up. Buffering becomes a rare worst case rather than the default.
Why transcode video in chunks instead of the whole file?
Chunking splits the video into short segments that encode independently and in parallel, which wins on two fronts. Speed: hundreds of chunks encode at once across many workers, so a two-hour upload is ready in minutes instead of hours of serial encoding. Fault tolerance: if a worker crashes, you retry one three-second chunk rather than restarting the entire encode. Chunk-level transcoding is also what lets early renditions start publishing before the whole video has finished processing.
How does a video platform count views at scale without overloading the database?
It never writes one increment per view to a single hot row. Each view emits an event onto a stream (such as Kafka), and a separate aggregator counts those events in short time windows and applies batched increments to a cached counter, flushing to the database periodically. Viewers see an approximate count served from cache, which is reconciled to the exact total offline. This keeps the playback path from ever waiting on the counter, so even a viral spike produces batched writes instead of millions of per-view updates to one row.
How do I practise a system design interview out loud?
Reading a walkthrough is not the same as defending a design while someone interrupts. On Zynter, the HLD track runs live voice rounds modelled on how real system design loops run — you talk through a shared design on the canvas, and a voice interviewer pushes with the follow-ups above one at a time, then gives you a debrief on problem solving, communication, technical execution, and time management. The score is a practice signal, not a hiring decision.
Practise it on Zynter
You can read every hop. The round is won on the transcode pipeline and the delivery path.
Pick the Video Streaming round, draw the upload-transcode-deliver flow on the canvas, and defend it out loud to a voice interviewer that keeps asking "why chunk the transcode?" and "a video goes viral — how does your view count survive?" — then read the debrief. Zynter.ai is on-demand mock interviews modelled on real company loops, with 150+ rounds across 20 companies including the HLD system design track (Sep 2026).
Practise the Video Streaming round →
Browse all interview tracks




Top comments (0)