YouTube: Requirements & High-Level Design
Problem Statement
Design a video platform like YouTube. Creators upload videos of up to 256 GB or 12 hours from any connection, and an upload that breaks off resumes where it stopped. Every upload is processed into versions that play on every device — several resolutions and codecs, cut into short segments — with thumbnails and copyright checks, and it becomes watchable within minutes. Viewers watch on phones, computers and TVs: playback starts within two seconds and the quality follows the network without stalling. Videos are public, unlisted or private. The watch page shows view counts. The service has billions of monthly users; hundreds of hours of video arrive every minute and a billion hours are watched every day.
The functional requirements below come from its verbs; the rest of the statement sets the non-functional ones.
Introduction
YouTube was founded in 2005 and bought by Google in 2006. The numbers it has published since describe a system built mostly for watching:
| What | Number | Published |
|---|---|---|
| Video uploaded | "more than 500 hours of fresh video per minute" | YouTube, at press events in May 2019 |
| Video watched | "a billion hours of YouTube's incredible content every single day" | YouTube's blog, February 2017 |
| Videos stored | "nearly 10 billion public videos"; median 35 views each | a random sample of YouTube, 2022 |
| Shorts | "averaging over 200 billion daily views" | YouTube's press page, 2026 |
| Revenue | ads $40.4 billion (2025); ads and subscriptions over $50 billion a year (2024) | Alphabet's annual report; its CEO |
Every hour uploaded is watched, on average, well over a thousand hours. That ratio shapes the whole design: an upload is worth almost any amount of work if it makes each of those viewing hours cheaper, faster or better.
What makes the system hard:
| Challenge | Why it is hard |
|---|---|
| Huge, fragile uploads | Files of tens of gigabytes arrive over phone connections that drop. A break at 80% must not cost the first 80% |
| Processing costs | Every upload becomes many versions — resolutions times codecs. The efficient codecs take several times the computing of the old one |
| Speed to watch | A creator wants the video live in minutes; a 4K version takes far longer to make than a 360p one |
| Delivery | A billion hours a day is tens of millions of simultaneous streams. Sent from a few data centers, every byte would cross the internet for every view |
| The long tail | Most videos are watched a few dozen times; a tiny fraction draws almost all the views. Caches must hold the head without paying for the tail |
| Networks change | A phone moves from Wi-Fi into a tunnel. The player must change quality before its buffer runs dry |
| Counting | A popular video's views arrive from many viewers at once, and the counts must leave out bots |
The Design in One Paragraph
An upload goes straight to object storage in a resumable session: fixed-size chunks, each acknowledged, so a broken connection resumes from the last chunk. When it completes, a processing graph starts: probe the file, check it, and encode a ladder of renditions — resolutions times codecs — each cut into segments of a few seconds that start at the same frames in every rendition. A low-resolution path is scheduled first, so the video becomes playable within minutes, and higher qualities are added as they finish. Viewers fetch a manifest and then segments over HTTP from caches — inside ISPs, at edge sites, at regional sites — which hold the popular head of the catalogue; misses fall back to object storage. The player chooses each segment's quality from its buffer and recent throughput. Metadata lives in a database sharded by video; views are sent as events and counted by a separate job.
Related lessons: the building blocks are in HTTP/1.1 to HTTP/2 to HTTP/3 (QUIC), Global Load Balancing: GeoDNS & Anycast, Idempotency: Safe to Retry, Message Queues: Absorbing the Burst, Delivery Semantics: At-Most, At-Least, Exactly-Once, Cache Eviction: LRU, LFU, TTL, FIFO, Stampedes, Thundering Herds & Cache Warming, CDNs: Caching at the Edge and CDN Invalidation & Edge Strategies (Fundamentals of System Design), Block vs File vs Object Storage, Design an S3: Blob Storage as a System, Erasure Coding vs Replication, Media Chunking, Video Transcoding Pipelines, Choosing a Shard Key, Resharding & Hot Shards and Outbox + CDC: Reliable Events from Your Database (Data Systems at Scale), Distributed Locks & Leases and Retries, Budgets & Retry Storms (Distributed Systems & Reliability), Streaming Engines and Windowing & Exactly-Once (Architecting Production Systems), and Pattern: Handling Large Blobs and S3 & Object Storage, Inside-Out (System Design Interview Mastery).
Functional Requirements
We extract the operations from the verbs of the problem statement:
FR1 — Upload videos. A creator uploads a file of up to 256 GB or 12 hours, whichever is less — YouTube's own limit. An upload that breaks off continues from where it stopped, and the stored file is checked against what the client sent.
FR2 — Process them. Each upload is turned into renditions at several resolutions and codecs, cut into segments for adaptive streaming, with thumbnails, and checked against copyright references and the platform's rules. A low-quality version becomes watchable first; higher qualities follow.
FR3 — Watch. A viewer plays a video on any device, seeks anywhere in it, and gets the quality the network can carry. Unlisted videos play for anyone with the link; private ones only for the people allowed.
FR4 — Manage. The creator sets the title, description and visibility, and sees the processing state.
FR5 — Count. The watch page shows the number of views and likes, counted after invalid views are removed.
Out of scope: search and recommendations, comments, live streaming, ads, the Shorts feed, subscriptions and notifications. Each is a system of its own.
Non-Functional Requirements
The rest of the problem statement gives the quality requirements:
- "starts within two seconds" → Latency
- "follows the network without stalling" → Smooth playback
- "watchable within minutes" → Freshness
- "resumes where it stopped" → Reliability of uploads
- "billions of monthly users", "a billion hours" → Scale
Three more follow from what the service is: Availability, Durability and Security.
Latency
- Playback starts within 2 seconds for most plays. A study of 23 million views found that viewers "start to abandon a video if it takes more than 2 s to start up, with each incremental delay of 1 s resulting in a 5.8% increase in the abandonment rate."
Smooth playback
- Few stalls: the player keeps a buffer and lowers the quality before the buffer runs out.
Freshness
- A low-quality version is watchable within minutes of the upload finishing. Higher qualities may take longer: YouTube says "A 4K video with a frame rate of 30fps that is 60 minutes long can take up to 4 hours to finish high-resolution processing."
Reliability
- A broken upload loses at most the chunk in flight. An acknowledged upload is never lost.
Availability
- Watching: 99.99% — about 52 minutes a year. Each minute of a full outage would cost on the order of $95,000 of YouTube's 2024 ads and subscription revenue.
Durability
- Uploads and renditions are kept in object storage designed for 99.999999999% durability a year, as Amazon S3 and Google Cloud Storage both state.
Security
- Upload URLs expire and reach only their own object. Private videos' segments are served only with a valid playback token.
Scale
- Estimated next, from YouTube's own figures.
Resource Estimation
What YouTube Publishes
YouTube publishes few totals, and the ones it has published are years old. We use them with their dates:
| Fact | Value | Source |
|---|---|---|
| Video uploaded | "more than 500 hours of fresh video per minute" | YouTube at press events, May 2019 |
| Video watched | "a billion hours of YouTube's incredible content every single day" | YouTube's blog, February 2017 |
| Public videos | about 10 billion; mean length 615 s, median 126 s; median 35 views | a random sample of YouTube, 2022 |
| Shorts | "averaging over 200 billion daily views" | YouTube's press page, 2026 |
| Upload limit | 256 GB or 12 hours, whichever is less | YouTube Help |
| Recommended upload bit rates | 8 Mb/s for 1080p at 30 frames a second; 35–45 Mb/s for 2160p | YouTube Help |
Our Design Point
| Assumption | Value | Why |
|---|---|---|
| Uploaded | 500 hours a minute | YouTube's newest published figure |
| Watched | 1 billion hours a day | the same, from 2017 |
| An upload's bit rate | 8 Mb/s on average | YouTube's recommendation for 1080p at 30 frames a second; for 4K it advises 35–45 Mb/s |
| A stream's bit rate | 2 Mb/s on average | between the 720p (0.9 Mb/s) and 1080p (1.7 Mb/s) rungs of the VP9 ladder we measured, with some 4K on televisions |
| Busiest hour | 2× the day's average | our assumption |
| Segment length | 4 s | the player fetches one segment of video at a time |
Traffic
| What | Calculation | Result |
|---|---|---|
| Videos uploaded | 720,000 hours a day ÷ 615 s a video | ~4.2 million a day, about 49 a second |
| Upload bandwidth | 720,000 hours × 3,600 s × 8 Mb/s ÷ 86,400 s | 240 Gb/s on average |
| Streams playing at once | 1 billion hours ÷ 24 hours | 41.7 million on average |
| Delivery bandwidth | 41.7 million × 2 Mb/s | 83 Tb/s on average, 167 Tb/s in the busiest hour |
| Segment requests | 41.7 million ÷ 4 s | 10.4 million a second for video alone |
| Watching per hour uploaded | 1 billion ÷ 720,000 | 1,389 hours |

Bandwidth is set by the streams playing at the same moment, not by how many plays start each second: multiplying starts per second by a bit rate undercounts by the length of a viewing, here by a factor of thousands. And the two directions are not alike: 347 bits leave for every bit that arrives. The upload side is a large but ordinary data-transfer problem; the delivery side is why YouTube places caches inside other companies' networks.
Storage
| What | Calculation | Result |
|---|---|---|
| Originals, kept for re-encoding | 720,000 hours × 3,600 s × 8 Mb/s | 2.6 PB a day, about 0.95 EB a year |
| Renditions of a 1080p upload | VP9 up to 1080p (3.64 Mb/s, measured) + H.264 up to 1080p (12.07 Mb/s, Apple's ladder) | 5.1 PB a day |
| An AV1 ladder | 3.69 Mb/s up to 1080p, measured | encoded only for videos whose views pay for it |
| The public catalogue | 10 billion videos × 615 s | 1.7 billion hours |
The H.264 ladder dominates the renditions because its bit rates are fixed: on our test film Apple's 1080p rung spent 5.9 Mb/s where VP9, which adapts to the picture, spent 1.7. Spending bits by content rather than by a table is the per-title encoding of the deep dives. Object storage adds its own redundancy on top of these numbers; it is the store's job, priced into the store.
What an Outage Costs
YouTube's ads earned $40.4 billion in 2025 — about $77,000 a minute — and ads and subscriptions together passed $50 billion a year in 2024, about $95,000 a minute. That is the order of what a minute of total outage forgoes, and why the design avoids any single component that every view depends on.
Data Model
The metadata is small next to the video: a few rows per video against gigabytes of segments. It lives in a relational database split by video_id; the bytes live in object storage and are referenced by key.
-- A channel owns videos; one person can run several channels.
CREATE TABLE channels (
channel_id bigint PRIMARY KEY,
handle text NOT NULL UNIQUE, -- the @name in channel URLs
title text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now()
);
-- One row per video: what the watch page and the player need.
CREATE TABLE videos (
video_id char(11) PRIMARY KEY, -- random id, the v= of the watch URL
channel_id bigint NOT NULL REFERENCES channels,
title text NOT NULL,
description text NOT NULL DEFAULT '',
visibility text NOT NULL DEFAULT 'private' CHECK (visibility IN ('public', 'unlisted', 'private')),
state text NOT NULL DEFAULT 'uploading'
CHECK (state IN ('uploading', 'processing', 'playable', 'failed', 'blocked')),
duration_ms integer, -- known once the upload has been probed
original_key text, -- the upload as received, kept for re-encoding later
created_at timestamptz NOT NULL DEFAULT now(),
published_at timestamptz
);
-- A channel's list of videos, sharded by channel: the videos themselves are spread by video_id.
CREATE TABLE channel_videos (
channel_id bigint NOT NULL REFERENCES channels,
created_at timestamptz NOT NULL,
video_id char(11) NOT NULL REFERENCES videos,
PRIMARY KEY (channel_id, created_at, video_id)
);
-- An upload in progress: the client resumes against it; the server checks what arrived.
CREATE TABLE upload_sessions (
session_id uuid PRIMARY KEY,
video_id char(11) NOT NULL REFERENCES videos,
object_key text NOT NULL UNIQUE, -- a fresh key per session, so a leaked URL reaches nothing else
size_bytes bigint NOT NULL,
sha256 bytea, -- declared by the client, checked against the stored object
expires_at timestamptz NOT NULL,
completed_at timestamptz
);
-- The processing graph: one row per task of a video, and the tasks it waits for.
CREATE TABLE tasks (
video_id char(11) NOT NULL REFERENCES videos,
task text NOT NULL, -- 'probe', 'encode vp9 1080', 'package vp9 1080', 'check', ...
needs text[] NOT NULL DEFAULT '{}', -- tasks that must be done before this one may start
priority smallint NOT NULL DEFAULT 5, -- lower first: the low-resolution path is 0, so it publishes first
state text NOT NULL DEFAULT 'waiting' CHECK (state IN ('waiting', 'running', 'done', 'failed')),
attempts smallint NOT NULL DEFAULT 0,
lease_until timestamptz, -- a worker's claim; a claim that runs out is taken again
PRIMARY KEY (video_id, task)
);
-- Every rendition the player may be offered; a row appears once its segments and manifest are stored.
CREATE TABLE renditions (
video_id char(11) NOT NULL REFERENCES videos,
codec text NOT NULL CHECK (codec IN ('h264', 'vp9', 'av1')),
height smallint NOT NULL,
kbps integer NOT NULL,
segment_ms integer NOT NULL,
ready_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (video_id, codec, height)
);
-- The counts the watch page shows, written by the counting job, never by each view.
CREATE TABLE video_counts (
video_id char(11) PRIMARY KEY REFERENCES videos,
views bigint NOT NULL DEFAULT 0,
likes bigint NOT NULL DEFAULT 0,
counted_to timestamptz NOT NULL -- every validated event up to here is included
);channels— the creator's account on the site. One person can run several channels; videos belong to a channel.videos— one row per video, everything the watch page needs. The id is random — 11 characters of URL-safe text, like YouTube's — so it reveals neither the order of uploads nor how many there are, and it spreads evenly across shards.statemovesuploading→processing→playable(orfailed,blocked).original_keykeeps the upload itself: re-encoding the catalogue with a newer codec needs the original, not a rendition.channel_videos— a channel's list of videos, newest first. It repeats three columns ofvideosso that a channel page is one query on one shard: the videos are spread byvideo_id, this list bychannel_id.upload_sessions— one row per upload in progress: where the bytes go, how big the file is, its SHA-256, when the session expires. The client resumes against it; the server checks the finished object against it.tasks— the processing graph of each video: one row per step, with the steps it needs and a priority. Workers take ready tasks with a lease (next section).renditions— what the player may be offered. A row appears only when a rendition's segments and manifest are stored, so the manifest never names segments that do not exist.video_counts— the counts on the watch page, written by the counting job up tocounted_to, never by each view.
Elsewhere
| Data | Where | Key | Size |
|---|---|---|---|
| The upload as received | object storage | original_key | gigabytes per video |
| Segments of every rendition | object storage, cached near viewers | video, codec, height, segment number | most of the bytes served |
| Manifests (DASH, HLS) | object storage, cached | video | kilobytes |
| Thumbnails | object storage, cached | video | kilobytes |
| View events | a partitioned log | video id | a few hundred bytes per view |
| Playback tokens for private videos | signed by the API, checked at the cache | — | none stored |
API Design
Three kinds of traffic reach the servers: small API calls to the metadata servers, upload bytes to the upload service, and segment requests to the caches. Every API call carries the user's OAuth token.
Start an Upload
POST /v1/uploads
Request:
{
"title": "How a video gets to your phone",
"visibility": "private",
"size_bytes": 6442450944,
"sha256": "6d3f0a1c…",
"content_type": "video/mp4"
}
Response (201 Created): {"video_id": "dQw4w9WgXcQ", "session_uri": "https://upload.example.com/v1/sessions/7f2c9d…", "chunk_bytes": 8388608, "expires_at": "2026-10-22T09:00:00Z"} — the session URI is unguessable, reaches only this video's object, and expires: it is the credential for the bytes, so it is sent only over TLS and never logged.
Upload a Chunk
PUT {session_uri}
Request: the next chunk_bytes of the file, with Content-Range: bytes 0-8388607/6442450944. Chunk sizes are multiples of 256 KiB, as in Google's protocol.
Response (308 Resume Incomplete): Range: bytes=0-8388607 — the bytes the server has. The last chunk instead gets 201 Created with {"video_id": "dQw4w9WgXcQ", "state": "processing"}, once the stored object's SHA-256 matches the declared one; a mismatch gets 422 and nothing is published.
Resume After a Break
PUT {session_uri}
Request: an empty body with Content-Range: bytes */6442450944.
Response (308 Resume Incomplete): Range: bytes=0-5368709119 — continue from the next byte. This is the protocol of YouTube's own Data API.
Get a Video
GET /v1/videos/{video_id}
Response (200 OK):
{
"video_id": "dQw4w9WgXcQ",
"title": "How a video gets to your phone",
"state": "playable",
"duration_ms": 734000,
"manifest_url": "https://media.example.com/v/dQw4w9WgXcQ/manifest.mpd",
"thumbnail_url": "https://media.example.com/v/dQw4w9WgXcQ/default.jpg",
"views": 1245890
}
For a private video, manifest_url carries a short-lived signed token that the caches check on every segment request. While processing continues, the manifest lists the renditions that exist so far.
Fetch Segments
GET https://media.example.com/v/{video_id}/{codec}-{height}/{segment}.m4s
Response (200 OK): the segment's bytes, from the nearest cache that holds them. Segments never change once written, so they are cached for as long as there is room.
Report a View
POST /v1/views
Request: {"view_id": "8f1c2e…", "video_id": "dQw4w9WgXcQ", "position_ms": 0} — sent when playback starts; view_id is chosen by the player, so a retry is recognised.
Response (202 Accepted): empty. The event goes to the view log; the count on the watch page changes when the counting job has validated it.
High-Level Design
We build the design up one requirement at a time.
1. One Server
The simplest video site takes the upload in one request, encodes it, keeps it on its disk and streams it to whoever asks.

Every requirement breaks:
- An upload that breaks off starts again. A 10 GB upload lost at 80% sends the first 8 GB a second time.
- Encoding needs more computing than one machine has. VP9 took 9.3 CPU-seconds per second of a busy scene in our measurement: about 9 CPU-hours for one hour of video, for one rung of the ladder, and the ladder has a dozen.
- Viewers need more bandwidth than one site can serve. A billion hours a day is 41.7 million streams at once, about 83 Tb/s.
- One disk holds every video. When it fails, they are gone.
2. Uploads Straight to Storage, Resumably
The API never carries a video's bytes. It opens an upload session and hands the client a URI for it; the client sends the file in chunks directly to object storage.

- The client starts the upload with the file's size and SHA-256. The upload service creates the video's row and an
upload_sessionsrow with a fresh object key. - It answers with the session URI. The URI is the credential for the bytes: unguessable, valid for one object, expiring.
- The client sends the file in chunks of 8 MiB. Each chunk is answered with the bytes the store holds, so after a break the client asks and continues from there.
- When the last chunk arrives, storage reports the finished object.
- The upload service checks the object's SHA-256 against the declared one. Only then does the video move to
processingand its tasks get written.
The upload service handles small requests only; the 240 Gb/s of uploads go straight into object storage, which is built to take them. The deep dives test what a session URI allows and how resuming works in Google's protocol and Amazon's.
3. A Graph of Tasks, the Low Path First
Processing is many independent jobs: probe the file, check it against copyright references and the rules, and for every rung of every codec an encode and a package step. They form a graph — an encode needs the probe, a package needs its encode — and they are rows of the tasks table, which workers take as they become ready.

- The low path goes first. The 360p H.264 encode, its packaging and the check have priority 0, and
publishneeds only them: the video plays while 4K is still encoding. YouTube does the same: "When you upload a video, it will initially be processed in low quality … your video will be available to stream in low quality first, on a wide variety of devices. Higher-quality videos, such as 4K or 1080p, can take more time to process." - Workers take tasks with a lease. A worker that dies leaves a task whose lease runs out, and another worker takes it; the dead worker's late "done" changes nothing.
- Each rendition joins when it is ready. A
renditionsrow appears when a rendition's segments and manifest are stored, and the manifest the player gets lists only those.
In our run of one 20-second 4K upload on four workers, this order made the video playable 7 seconds after the upload completed, against 53 seconds when tasks were taken in the order they were created; the deep dives show the schedule.
4. Watching Through Caches
A viewer's player asks the API for the video and gets the watch page with a manifest URL. From then on it fetches the manifest and the segments over plain HTTP from the nearest cache.

- Caches in tiers. The nearest is often inside the viewer's own ISP; a miss goes to an edge site, then a regional site, and finally to object storage. Each tier keeps what it fetched, so a popular segment travels the long way once.
- The player chooses the quality. Every segment exists in every rung; the player picks each one's rung from its buffer and the throughput it sees, so the quality follows the network.
- Segments never change. A segment written once is cached for as long as there is room; nothing is ever invalidated because it changed. Only a video taken down must be purged from the caches.
5. Metadata and Counts
The metadata is small and read far more often than it is written.

- Sharded by video. The watch page reads one video by
video_id, sovideo_idchooses the shard, and a cache in front holds the watch pages of popular videos. - A channel's list is kept by channel. "The latest videos of this channel" would otherwise ask every shard;
channel_videosis sharded bychannel_id. - Counts are not written per view. A view is an event in a log; a counting job validates the events, drops repeats and updates
video_countsevery few seconds.
6. The Whole Design

| Component | Does | Scales by |
|---|---|---|
| Upload service | Opens sessions, issues session URIs, checks the finished object's hash, writes the tasks | stateless: add servers |
| Object storage | Originals and segments, durably | the store's own scaling; a region near each uploader |
| Workers | Take tasks from the table: probe, check, encode, package | add machines; YouTube adds its own encoding chips |
| Metadata database | Channels, videos, sessions, tasks, renditions, counts, sharded by video; channel lists by channel | add shards |
| API (metadata servers) | Watch pages, manifests' URLs, video management | stateless, with a cache |
| Caches | Serve segments and manifests near the viewers, in tiers | more caches, closer to viewers |
| View log and counting job | Collect view events, validate them, write the counts | partitions of the log |
Three paths share one store and never wait for each other: uploads write originals, workers turn originals into segments, caches read segments. Each can grow or fail on its own.
7. The Life of a Video

| Step | Where | What happens |
|---|---|---|
| 1 | Creator's client → upload service | Starts the upload with the size and SHA-256; gets a session URI |
| 2 | Client → object storage | Sends the chunks; a break resumes from the bytes held; storage reports the completed object |
| 3 | Upload service | The hash matches; the video becomes processing and its tasks are written |
| 4 | Workers | Take the 360p task first; encode, package and store its segments |
| 5 | Workers → metadata | publish: the video becomes playable, with 360p in its manifest; higher rungs join as they finish |
| 6 | Player → API | Gets the watch page and the manifest URL |
| 7 | Player → nearest cache | Fetches segments; the first request for a segment goes up the tiers to object storage once, and every later one is served from the cache |