Skip to main content

YouTube: Interview Guide

Editorial

Staff-Level Discussion Topics

These are the questions a staff-level interview opens after the design stands. Each has a real answer at YouTube, or a measured one, to compare yours with.

Should We Build Our Own Encoding Chips?

YouTube did. It began designing a video transcoding chip in 2015 and described it in 2021: "We've seen up to 20-33x improvements in compute efficiency compared to our previous optimized system, which was running software on traditional servers." One reason, in the paper's words: "The high compute cost of VP9 makes it computationally infeasible at scale in software." In our measurement VP9 took 7.1 times the computing of H.264. The trade: hardware encodes a little worse per bit than the best software ("VCU VP9 is 18% greater BD-rate than libvpx"), and the gain in throughput pays for that many times over. A general-purpose hardware encoder is not the same thing: Apple's real-time H.264 encoder was fast but scored VMAF 89.7 where x264 scored 96.4 at the same bit rate.

Re-Encoding the Catalogue in a New Codec

The design keeps every original (original_key) for this. The cost is the question. The 2022 sample puts the public catalogue at about 10 billion videos of 615 seconds on average, 1.7 billion hours. One AV1 rung of all of it at SVT-AV1 preset 6 — 2.38 CPU-seconds per second of video in our measurement — is about 460,000 CPU-years. The views decide the order: the 3.67% of videos with 10,000 views or more drew 93.6% of views, so encoding them first is about 17,000 CPU-years per rung for nearly all the bandwidth saving. The rest may never be worth it; a video watched 35 times saves little.

Caches Inside Other Companies' Networks

Google places caches in ISPs' networks: "Typically between 70-90% of cacheable traffic can be served from GGC." The design questions are operational: the ISP provides "rack space, power … and a connection to your network" and saves traffic on its peering and transit links; Google provides the hardware and runs it remotely; the cache must fill itself from requests (pull), and each viewer must be sent to the cache inside their own network. Our model says a cache holding 1–5% of the catalogue serves 72–91% of requests, which is why caches that fit in ISPs' racks can serve most of the traffic.

Going Live

A live stream turns the pipeline into a clock. Encoding must keep up with real time for every rung at once, so encoders run fast presets or hardware; segments are packaged and published as they are produced; the manifest changes every few seconds and must not be cached as long as a segment; the low-first trick and per-title ladders have no time to work; and a viewer's delay behind the live edge is set by segment length and buffer, which low-latency modes such as Apple's Low-Latency HLS work to shorten. Uploads, storage and caching are reused; the processing graph is replaced by a real-time chain per stream.

Counting at Shorts Scale

Shorts average over 200 billion views a day, 2.3 million a second. A row per video cannot take that (250 increments a second with every commit flushed, in our test) and an in-memory counter loses what it has not flushed (19% of acknowledged views when we killed it). Views as events in a partitioned log, deduplicated by view_id and counted by a job, scale by partitions and can be recounted when the rules change — and YouTube's rules do change: from August 24, 2026, a view counts "the moment a video starts to play".

Copyright at Upload Scale

Every upload is checked: "When a video is uploaded to YouTube, it's automatically scanned by Content ID", against "a database of audio and visual files submitted by copyright owners". The check reads the whole video, runs beside the low path and gates publishing, so a blocked video is never served. A match is not always a block — the owner may choose to track or monetise, and the choice "can be geography-specific" — so the result is a policy recorded with the video, not a boolean.

Level Expectations

AreaMid-levelSeniorStaff
Requirements and estimateUpload, process, watch; "lots of traffic"Bandwidth from streams playing at once (83 Tb/s), not from plays started per second; read and write paths sized apartWorks from dated, published figures; separates measured, published and assumed numbers; sees that 1,389 hours watched per hour uploaded justifies expensive encoding
UploadsUpload to the server, then to storageDirect to object storage; resumable sessions or multipart; the hash checked before processingWhat a session URI or signed URL allows (anyone holding it), how to bound it, regions, abandoned uploads
Processing"Transcode into several resolutions"A graph of tasks; low quality first; codecs and a ladder; segmentsLeases and fencing, schedule order, chunked encoding, keyframe alignment, per-title ladders, encoding cost against bandwidth saved, hardware
Delivery"Use a CDN"Caches in tiers; adaptive bitrate per segment; why segments never changePopularity and hit ratios with numbers, caches inside ISPs, pull versus push, ABR rules and their failure cases, QUIC
Metadata and countsA videos tableSharded by video_id, a channel list by channel, a cache; counts batchedCounts as a validated event pipeline: idempotent, recomputable, scaling by partitions

Interview Cheatsheet

The Design in 60 Seconds

"Uploads go straight to object storage in resumable sessions, and nothing is processed until the stored file's hash matches. Each video's processing is a graph of tasks in a table, taken by workers with leases: probe, check, and an encode and a package per rung of each codec. The 360p path and the check go first, so the video plays within minutes while 4K encodes. Every rendition is cut into segments that start at the same keyframes. Players fetch a manifest from the API and segments from tiers of caches, the nearest inside their ISP, and pick each segment's rung from their buffer and throughput. Metadata is sharded by video; views are events in a log, validated and counted by a job."

Key Decisions

DecisionWhyInstead of
Resumable sessions straight to object storagea break costs one chunk; the API carries no video bytesone PUT through the application
A fresh object key, a short life, the hash checkeda leaked URL reaches one unfinished uploadtrusting the URL to identify the uploader
A task graph in a table, leases and fencingcrashes cost a lease, never a double resulta pipeline in memory
The low path first, then the longest encodesplayable in seconds; finished as early as the biggest encode allowsfirst come, first served
Keyframes forced at a fixed interval in every rungevery segment boundary is a switch pointthe encoder's scene-cut keyframes
Several codecs; AV1 for videos whose views pay for iteach device gets the most efficient codec it decodesone codec for all
Pull caches in tiers, close to viewersthe popular head fills them by itselfpushing videos to every edge
Player-side ABR with a long bufferthe quality follows the network; dips are absorbedserver-chosen quality
Views as events, counted by a jobdurable, deduplicated, recountableincrementing a row per view

Numbers to Remember

WhatNumberSource
Uploadedover 500 hours a minuteYouTube, 2019
Watcheda billion hours a dayYouTube, 2017
Public videosabout 10 billion; median 35 viewsrandom sample, 2022
Shortsover 200 billion views a dayYouTube, 2026
Upload limit256 GB or 12 hoursYouTube Help
Streams at once41.7 million; about 83 Tb/s at 2 Mb/sestimate
Views concentratedtop 0.16% of videos: 50.5% of views; top 3.67%: 93.6%random sample, 2022
VP9 against H.264, same VMAF49% fewer bits on a calm scene, 10% on a busy one; 7.1× the computingmeasured here
AV1 against VP9about 30% fewer bits on both scenesmeasured here
Low path firstplayable 7 s after the upload, not 53measured here
A cache of 1% of videos72% of requestsmodelled here
Startupabandonment starts after 2 s; +5.8% per extra secondKrishnan and Sitaraman, 2012
QUIC18.0% fewer rebuffers on desktop, 15.3% on mobileGoogle, 2017

Follow-up Questions

"The upload broke at 80%. Now what?" The client asks the session what it holds — an empty PUT with Content-Range: bytes */SIZE — gets 308 with the range, and sends the rest. With S3 it lists the parts and uploads the missing ones.

"How soon can a video be watched?" As soon as the low path is done: the 360p encode, its packaging and the check. YouTube streams "in low quality first"; 4K can take hours more, and its rungs join the manifest when ready.

"Why not publish when every rendition is done?" The slowest rung decides then: our 2160p VP9 encode took 161 seconds of a 20-second clip on four cores; an hour of 4K takes hours.

"How do you switch quality without a glitch?" Every rung's segments start at the same keyframes, forced at a fixed interval; the player changes rung at a segment boundary.

"How big must the caches be?" On YouTube's measured popularity, a least-recently-used cache of 1% of videos serves 72% of requests, 5% serves 91%; a regional tier behind small edges lifts 40% to 72%.

"How do you count a billion views a day correctly?" As events with ids, deduplicated and validated by a job, written as a count with the log position it covers; never one increment per view on a row.

Common Mistakes

  • Bandwidth from plays started per second. Bandwidth is streams at once times bit rate: thousands of times more.
  • A single signed PUT for a 10 GB file. It cannot resume; use a resumable session or a multipart upload.
  • "Only the creator can use the signed URL." Anyone holding it can, until it expires; bound what it reaches and check the hash.
  • Publishing after every rendition. Viewers wait for 4K; publish the low path first.
  • Letting the encoder place keyframes. Rungs disagree and segments vary in length; force them.
  • "VP9 is 30% better than H.264." It depends on the content: 49% on our calm scene, 10% on the busy one.
  • Pushing popular videos to every edge. Pull caches fill with each region's own head; push wastes their space.
  • A counter row per video, or an unflushed counter. One serialises, the other loses views.