Design a Global Video Streaming Platform (like YouTube or Netflix)
Design a video site for the whole world. It takes large uploads and turns each video into many sizes in parallel steps. Playback adjusts quality to the viewer (HLS or DASH).
Think of YouTube like a video printing press. You upload one raw master film, and it gets sliced and converted into 10 different resolutions, such as 4K, 1080p, 480p, and 240p. That way, phones on slow 3G can still play it smoothly.
- Clients
- Uploader
- Viewer
- Entry
- CDN edge
- Services
- Video service
- Transcoding workers
- Key service
- Queues, caches
- Transcode queue
- Data, outside
- Object storage
1. Requirements and scope
- Upload video files up to 10GB.
- Stream video with adaptive bitrate (4K, 1080p, 720p, 360p).
- Search and view video metadata, likes, comments.
- Low buffer latency (<2s initial play delay).
- Zero video corruption.
- Global edge delivery with 99.999% availability.
2. Back-of-the-envelope numbers
- Writes: 35 uploads a second (1%)
- Reads: 5,800 new views a second (99%)
Read-heavy: about 166 reads for each write. A cache and extra read copies help most here.
3. API
4. Data model and storage
VIDEOS Table: (id, uploader_id, title, duration, hls_manifest_url, status, created_at)
5. The design, in three versions
Version 1: Direct File Upload to Monolith
Browser uploads whole MP4 to web server; server saves to disk.
Global Video Streaming Platform (like YouTube or Netflix): Version 1: Direct File Upload to Monolith Version 1 of 3
The picture follows one request through the parts of this version, in order. Under it, switch a part off to see what the request does without it.
One request, step by step
Each numbered arrow is one step. Press "Simulate Request Flow" to follow them one at a time.
- The order of the steps
- A request or its reply
The parts: switch one off
1. Clients
2. Services
3. Data, outside
The steps in words0 of 3 steps shown
Uploader to Video service
The whole file is uploaded to the web server.
Video service to Local disk
The server saves it on its own disk.
Video service to Uploader
The uploader gets "done".
Write path, read path and failures
Each path follows one request through the final design (version 3), one hop at a time.
Write pathUpload a video
- Client
- Upload API
- Object storage
- Queue
- Transcoding workers
- Metadata database
Client to Upload API
The app asks to upload. The API returns a signed URL that allows a direct upload to storage.
Client to Object storage
The app splits the file into 5 MB parts and uploads them in parallel. A failed part is sent again alone.
Object storage to Queue
When the last part arrives, storage sends an "upload complete" message to a queue.
Queue to Transcoding workers
Workers cut the video into 5-second clips. They encode each clip at several qualities, such as 360p and 1080p, in parallel.
Transcoding workers to Object storage
They save the clips and a playlist file that lists every quality.
Transcoding workers to Metadata database
The video is marked ready, and viewers can now find it.
Read pathWatch a video
- Client
- Metadata API
- CDN edge
- Object storage
Client to Metadata API
The player asks for the video's details and the URL of its playlist.
Client to CDN edge
It downloads the playlist from a nearby edge server. Then it asks for the first clips at a quality that fits its network speed.
CDN edge to Object storage
If the edge does not have a clip, it fetches it from storage once and keeps a copy.
CDN edge to Client
The player measures each download. It moves to a lower quality when the network slows, and back up when it recovers.
What breaks, and what happens then
A transcoding worker crashes in the middle of a clip
- What users see
- That clip is not finished.
- What the design does
- The clip's message returns to the queue after a time limit, and another worker encodes it. Only that 5-second clip is redone.
An upload breaks at 90%
- What users see
- Without parts, the user would have to start again.
- What the design does
- The app asks which parts arrived and sends only the missing ones.
A video goes viral
- What users see
- Millions of players ask for the same clips.
- What the design does
- Edge servers hold those clips, so storage is read about once per edge location.
A CDN location fails
- What users see
- Players near it see errors.
- What the design does
- DNS or network routing sends them to the next nearest location, and the player retries the clip.
6. Deep dives
7. Follow-up questions
- How do you spot the same video uploaded twice? (Answer: compare a checksum of each block, or a hash of what the first frames look like.)
What it costs
Storage and delivery dominate: about 900 TB of new video a day, and the CDN bill grows with every view. Encode rarely watched videos in fewer sizes, and move old ones to a cheaper storage class.
Another way to design it
A smaller site can encode each video in one pass on one worker, with no split into clips. It is simpler and slower. Splitting matters when long uploads must be ready in minutes.
8. How answers are judged
A passing answer at Mid level. A complete design with numbers: about 35 uploads a second and millions of streams playing at once. It explains chunked upload and transcoding into several resolutions, and goes deep on one part.
| What is judged | Junior | Mid | Senior | Staff |
|---|---|---|---|---|
| BreadthHow much of the system does the answer cover? | Names the core parts: clients, servers, a database and a cache. | Covers the whole main flow, from the request to the stored data and back. | Builds a complete design without being led through it. | Covers the system, the systems around it and who owns each part. |
| DepthHow far does it go into the hard parts? | Explains what each part does and why it is there. | Goes deep on one part, such as the database or the cache. | Goes deep on the two or three riskiest parts. | Goes deepest where the risk is largest, and explains why the risk is there. |
| DrivingWho leads the conversation? | Follows the interviewer, step by step. | Moves forward alone, with an occasional nudge. | Leads the conversation from start to finish. | Changes the problem when the question asked is not the right one. |
| Trade-offsAre choices compared and justified? | Names more than one option. | Says why one option was picked over another. | Compares options in detail, with what each one costs. | Ties each choice to cost, speed and risk for the business. |
| Unclear questionsWhat happens when the question is vague? | Answers the questions that are asked. | Asks questions to make the problem clear. | Sets the scope and says what is left out. | Questions the assumptions behind the problem itself. |
| ScopeWhat does it consider beyond the normal path? | Covers the normal path, when everything works. | Adds what happens when a part fails. | Adds growth: what breaks at ten times the load, and the fix. | Adds abuse, cost and the daily work of running the system. |
Requirements and scope
Before I design, I want to check the scope. This is on-demand video: upload, transcode and stream, not live broadcasting. Should the original master file be kept after transcoding, in case we need a new resolution later, or deleted to save storage? I will assume it is kept for now.
Once a video is transcoded into every resolution we support, I would delete the original upload right away. Keeping it forever wastes storage space for no real benefit.
Shows: Unclear questionsThe difference: Deleting the original assumes future needs are known today. Without it, adding a new resolution later means asking users to re-upload instead of re-transcoding.
Estimates
500,000 hours uploaded a day, at about 10 minutes a video, is close to 3 million uploads a day, about 35 a second. At 300 MB per raw upload, that is about 900 TB a day, before the extra resolutions transcoding adds on top.
Three million uploads a day at about 300 MB each is about 900 TB a day. That is what I would provision object storage for and call it sized.
Shows: DepthThe difference: The weak answer sizes storage for the original upload alone. Transcoding into several resolutions adds more storage on top of that raw total.
Core design
The client uploads in chunks to a presigned URL so a dropped connection resumes instead of restarting. Once the upload finishes, a queue kicks off transcoding workers that build each resolution asynchronously. The video goes live once the first rendition is ready.
When the upload finishes, the server transcodes the video into every resolution right there in the same request. It only replies success once all of them are ready.
Shows: DepthThe difference: Transcoding a large video inline can take minutes, so the uploader waits that long. The strong answer transcodes asynchronously after the upload completes.
Deep dive
The hard part is serving video worldwide without buffering. The player measures its own download speed and switches between rendition chunks, from 4K down to 360p, without restarting playback. A CDN edge near the viewer caches the popular renditions, so most requests never reach the origin.
I would pick one good resolution, say 1080p, and stream that same rendition to every viewer, no matter their connection.
Shows: DepthThe difference: A single fixed resolution buffers on a slow connection and wastes bandwidth on a fast one. Adaptive bitrate switches renditions to match each viewer's connection.
Failures and trade-offs
If a video suddenly goes viral, its CDN cache entries can expire at the same moment, sending many viewers' requests to the origin server together. I would combine those into one origin fetch per rendition, and give popular videos a longer edge cache lifetime so this happens less often.
If a video goes viral, the CDN keeps serving copies from its edge cache. The origin server never sees any extra load from it.
Shows: ScopeThe difference: Cache entries can still expire at the same moment for a hot video, sending a burst of requests to origin together. The strong answer combines those instead.
We wrote this guide in our own words, informed by public interview guides such as AlgoMaster and Hello Interview. We are not connected to either site. Interviewers differ. The guide and the example answers show the direction each level takes, not a checklist.
10. Check your design with your own AI
Write your design first. Then copy this prompt into the AI chat you already use, and add your design at the end. It asks for a score in each area, one fix for each, and two follow-up questions.
The site sends nothing anywhere. An AI review can be wrong, so check what it says against sections 8 and 9.
See the prompt
You are a system design interviewer. Review my design for the interview problem below. Problem: Design a Global Video Streaming Platform (like YouTube or Netflix) Design a video site for the whole world. It takes large uploads and turns each video into many sizes in parallel steps. Playback adjusts quality to the viewer (HLS or DASH). What users must be able to do: - Upload video files up to 10GB. - Stream video with adaptive bitrate (4K, 1080p, 720p, 360p). - Search and view video metadata, likes, comments. How well it must work: - Low buffer latency (<2s initial play delay). - Zero video corruption. - Global edge delivery with 99.999% availability. Numbers to assume: - 500 Million daily video views, 500,000 hours of video uploaded daily. Judge my design at the Mid level. A passing answer at this level: A complete design with numbers: about 35 uploads a second and millions of streams playing at once. It explains chunked upload and transcoding into several resolutions, and goes deep on one part. For each area below, say whether my design is strong, fine or weak. Give one reason and one fix for each: 1. Requirements and scope 2. Estimates 3. Core design 4. Deep dive 5. Failures and trade-offs Then ask me the two follow-up questions an interviewer would ask next. Do not write a full model answer for me. My design: [Describe your parts, how one request moves through them, and why you chose each one.]