// Heavy Systems + Your Rehearsal
Design a video platform
System Design track · 25 min
- Split a video platform into its two flows, upload and playback, and design each one.
- Explain chunked resumable upload, the transcoding pipeline, and adaptive bitrate playback.
- Show why the CDN, not storage, decides the bill.
You upload a video from your phone, and a minute later a friend in another country presses play and it just works. Behind that sentence sit two systems worth studying: a factory that turns one raw file into many streamable versions, and a delivery network that serves huge amounts of video every day without touching your own servers for most of it.
Design both and you have designed one of the hardest parts of the modern internet.
Say it in the first minute: a video platform is two flows.
The upload flow: a creator sends a raw file, and the system stores it and converts it (transcoding) into every quality it will ever be watched at. The playback flow: a viewer presses play, and small pieces of video stream to their device at whatever quality their connection can handle right now.
The two flows share storage and almost nothing else. They grow separately and they fail separately. Numbers for your estimate: about 500 hours of video uploaded every minute (YouTube's public figure), viewing far heavier than uploading, and each finished video becoming 6 to 10 output files.
One hour of raw 4K footage can be 50 GB. You do not send that in one request.
The app splits the file into chunks, say 8 MB each, so 50 GB is about 6,250 chunks. It uploads them to object storage (a service like S3 built for large files) and records which chunk numbers succeeded. If the connection drops, you resend that chunk, not the whole file: retry chunk 4,217, not 50 GB.
When the last chunk lands, a “done” event fires, and storage now holds one original copy that never changes. Object storage also copies the data across machines for you, so the original survives a dead disk without you writing that code.
The “done” event drops a job on a queue, and workers run a chain of tasks shaped as a DAG (a graph of steps where some run in parallel and some must wait). First, split the original into segments. Then convert every segment to 1080p, 720p, 480p and 360p in parallel. Finally, join the results and write the manifest files.
Why a DAG and not one long script? Parallel where the work is independent: every (segment, quality) pair is its own task on its own worker. In order where it depends: joining cannot start until every segment for that quality is done.
Why a queue and not a direct call? Transcoding takes minutes to hours. The creator should not wait, a worker that dies mid-segment must be retried, and the queue absorbs the evening upload rush instead of your servers.
The player never downloads “a video”. It fetches a manifest, a small text file that lists every quality as a series of 2 to 6 second chunks. Then it downloads chunk by chunk, measuring the speed of each one.
The connection slows down? The next chunk is requested at 480p. It recovers? Back to 1080p, in the middle of the scene. That is the match from the start of the lesson.
All the decision-making lives in the player. The servers just hand out chunks. That is the whole idea of adaptive bitrate streaming: put the intelligence where the measurement is.
Video popularity is very uneven: a small share of videos gets most of the watch time. That share sits on the CDN, in servers close to viewers, which you met in the caching lesson. A warm CDN serves the chunk without ever calling you.
Your origin (your own storage and servers) sees only two things: cache misses for old or brand-new videos, and new files coming from the transcoding pipeline. So size the origin for misses, not for total traffic. Serving every play from one origin would need many times more outbound bandwidth, and it would still be slower, because distance adds delay.
Object storage costs cents per gigabyte per month. Bandwidth is charged per gigabyte delivered, and it grows with success: every hour someone watches costs you again. That is why the CDN is not an optional speed-up. It is the business model.
The metadata (title, owner, duration, the list of manifests) lives in a relational database with strong consistency. It is tiny next to the videos, you query it in relational ways (videos by this creator, newest first), and it is the one part you cannot afford to lose or show out of date.
A video platform is two systems sharing a storage bill: a slow, patient factory that turns uploads into streamable files at its own pace, and a read-heavy delivery network that serves those files from close to the viewer. Once you see the split, every decision falls into place: queues, retries and DAGs on the factory side; caching, location and bandwidth cost on the delivery side.
A creator's upload dies at 92% on hotel Wi-Fi. What exactly gets retried, and why is the transcoding pipeline never blocked by this?
Answer in your head first, then check.
Draw it as two boxes: chunked, resumable upload into object storage, a queue-fed transcoding DAG, a player that adapts quality from a manifest, and a CDN that leaves your origin handling only misses. Storage is cheap, bandwidth is the bill, and the metadata, small and precious, is the only part that needs a real database.
Take one large file your system moves today, such as a CSV import, a report or a backup, and make its transfer chunked and resumable: fixed-size parts, a record of finished part numbers, and resume from the first missing part. Then list, one sentence each, which of your current direct jobs would need a queue and a DAG if traffic grew a hundred times.
- Split a video platform into its two flows, upload and playback, and design each one.
- Explain chunked resumable upload, the transcoding pipeline, and adaptive bitrate playback.
- Show why the CDN, not storage, decides the bill.
Heavy Systems + Your Rehearsal