Ravindra BagaleCourses & study guides Track your progress

Guides

YouTube Architecture Explained: How YouTube Stores and Streams Video

Short answer: YouTube runs on Google's own infrastructure, not on a rented public cloud region. Uploaded videos are transcoded by Google's custom Video Coding Unit (VCU) chips (2021). Data lives in Google databases such as Bigtable and Spanner (2023). Videos reach viewers through Google's network and Google Global Cache servers placed inside internet providers. Years ago YouTube built Vitess to scale MySQL.

Suppose a creator in Pune uploads a cooking video

A creator in Pune uploads a 10-minute video recipe for misal pav. Next morning, viewers in Delhi and Dubai watch it. In simple terms:

  1. The upload goes to Google's network and into YouTube's storage.
  2. YouTube transcodes the video into many sizes and formats (from phone quality up to 4K, using codecs like H.264, VP9 and AV1).
  3. Since 2021 much of this work runs on Google's custom VCU chips, which are 20 to 33 times more compute-efficient than its old system.
  4. Video details (title, channel, views) are stored in Google databases like Bigtable and Spanner.
  5. A viewer in Delhi presses play. The video segments come from a nearby Google edge site or a Google Global Cache server inside the viewer's internet provider.
  6. Views and watch time flow into YouTube's data warehouse on Bigtable, powering creator analytics.

What architecture style does YouTube use?

YouTube is part of Google and uses Google's shared building blocks.

  1. Custom hardware for video (2021): YouTube built the VCU, a chip just for transcoding, because more than 500 hours of video are uploaded every minute.
  2. Google databases (2023): YouTube uses Bigtable for recommendations data, view counts, ads and its data warehouse; operational data also lives in Spanner.
  3. Edge caching inside ISPs: Google Global Cache servers sit in internet providers' networks to serve popular videos close to viewers.
  4. Service style: the exact list of YouTube's internal services is not publicly shared.

YouTube architecture diagram (public parts)

This diagram shows only what YouTube or its partners have shared publicly. Press Play to follow a request step by step.

Watch the orange dot follow each numbered step.
YouTube architecture from public information (simplified)Google data centresGoogle edge and Google Global Cache inside ISPsSimplified; based on publicly shared information.Viewer / creatorapp or browserGoogle front endload balancingYouTube servicesGoogle infrastructureBigtableviews, recs, warehouseSpanneroperational dataVCU transcodingcustom chips (2021)Monitoringnot publicly detailedGoogle Global Cachevideo segments in ISPs
  1. A viewer opens a video.
  2. Google's front end receives the request.
  3. YouTube services build the watch page.
  4. View counts and recommendation data come from Bigtable.
  5. Operational data comes from Spanner.
  6. Uploaded videos were transcoded on VCU chips.
  7. Systems are monitored.
  8. Video segments stream from a cache near the viewer.
  9. The video plays.
Diagram 1: the public parts of YouTube's architecture. Simplified; based only on publicly shared information. Open the diagram as an image (PNG) · WebP

What does YouTube use? Main technologies

LayerWhat YouTube uses (public)What it does in simple words
HostingGoogle data centresRuns YouTube
TranscodingVideo Coding Unit (VCU) chipsConverts uploads to many formats
CodecsH.264, VP9, AV1Compress video
DatabasesBigtable, SpannerStore metadata, views, analytics
MySQL scaling (history)VitessSharded MySQL, now a CNCF project
Video deliveryGoogle edge + Google Global CacheServes video from nearby
AnalyticsData warehouse on Bigtable (2023)Creator dashboards, payments

Which cloud provider does YouTube use?

YouTube runs on Google's own infrastructure. It is not a customer of a public cloud region in the usual way. Its databases (Bigtable, Spanner) are the same technology Google sells on Google Cloud.

Why does YouTube need so much video processing?

The reasons:

  1. A video is uploaded in one format but watched on phones, laptops and 4K TVs, so each upload must be converted into many versions.
  2. Better codecs save internet bandwidth but cost more computing. A VP9 encode uses about 5 times more compute than H.264, and AV1 needs even more.
  3. In early 2020 watch time grew about 25% worldwide and daily livestreams grew 45% in the first half of the year. Because the VCU system was already in place, YouTube could scale to meet this surge.
  4. The VCU project began in 2015, and later chip generations add AV1 support.

The lesson for learners: when one job (like transcoding) dominates your costs, special hardware or a managed service built for that job can be far cheaper than general servers.

How it started: MySQL and Vitess (2010 to 2015)

  1. YouTube first stored its data in MySQL. To scale it, YouTube engineers built Vitess in 2010, a system that shards MySQL and pools connections.
  2. By 2015 Vitess could run on Kubernetes.
  3. Vitess later became a graduated CNCF project used by many companies.
  4. In 2015 YouTube also started the VCU project, which reached production by 2021.

How does YouTube store data?

  1. Video files are stored in Google's storage systems; the exact system is not publicly shared.
  2. Bigtable stores recommendation data, view counts, ad data and the data warehouse.
  3. Spanner stores operational data that feeds the warehouse.
  4. Popular videos are cached in Google Global Cache servers in ISPs.

How does YouTube monitor its systems?

YouTube's monitoring setup is not publicly shared in detail. Google is known for Site Reliability Engineering practices, which shape how Google runs production services in general.

If we built an app like YouTube on AWS (illustrative)

Please read this first

This section is a learning design by Ravindra Bagale. It is not YouTube's real setup. YouTube runs on Google's own infrastructure. We use AWS here because it is what you learn in the AWS course.

Suppose you want to build "ShikshaTube", a video site for school lessons. Here is a simple AWS layout.

1. Network: VPC, subnets, route tables, gateways

  1. Create one VPC with CIDR 10.0.0.0/16 in the Mumbai region (ap-south-1).
  2. Use two Availability Zones (A and B), so one AZ failing does not stop the app.
  3. In each AZ make three subnets: public (load balancer, NAT gateway), private app (your code) and private data (databases, cache).
  4. Attach one internet gateway (IGW) to the VPC. Public route table: 0.0.0.0/0 → IGW. This route is what makes a subnet public.
  5. Private app route table: 0.0.0.0/0 → NAT gateway, so servers can download updates but nobody can connect in from the internet.
  6. Private data route table: only the local VPC route. Use VPC endpoints to reach S3, DynamoDB and SQS without going over the internet.

2. Compute: where the code runs

  1. ALB in public subnets.
  2. Video API on EKS in private subnets.
  3. Uploads trigger transcode jobs through SQS to AWS Elemental MediaConvert.

3. Storage and databases

  1. S3 for original and transcoded videos.
  2. CloudFront to stream HLS segments.
  3. Aurora for channels and video details.
  4. DynamoDB for views and likes; ElastiCache for hot pages.

4. Monitoring

  1. CloudWatch metrics for errors, cache hit ratio and transcode backlog.
  2. X-Ray traces.

Request flow diagram

Press Play. The numbered list below the diagram lights up with each step.

Watch the orange dot follow each numbered step.
If we built a YouTube-like app on AWS (illustrative)AWS Region (for example ap-south-1, Mumbai)VPC 10.0.0.0/16Availability Zone AAvailability Zone BPublic subnet 10.0.1.0/24RT: 0.0.0.0/0 → IGWPublic subnet 10.0.2.0/24RT: 0.0.0.0/0 → IGWApp subnet 10.0.11.0/24RT: 0.0.0.0/0 → NATApp subnet 10.0.12.0/24RT: 0.0.0.0/0 → NATData subnet 10.0.21.0/24RT: local onlyData subnet 10.0.22.0/24RT: local onlyvia VPC endpointsIllustrative learning design only. This is NOT the company's real setup.Userphone appRoute 53DNS lookupCloudFrontCDN edge cacheAmazon S3video segmentsIGWApplication Load Balancerspans both AZsNAT gatewayNAT gatewayVideo APIEKS pods (auto scaling)Video APIEKS pods (auto scaling)ElastiCachewatch pages, countsAurorachannels, videosElastiCachewatch pages, countsAuroraread replicaSQStranscode jobsDynamoDBview counts, likesCloudWatch + X-Raymetrics, logs, traces
  1. A student opens a lesson. Route 53 answers.
  2. Video segments stream from CloudFront.
  3. On a miss CloudFront reads S3.
  4. API calls enter through the internet gateway.
  5. The ALB forwards to a pod.
  6. The video API builds the page.
  7. Hot data from ElastiCache.
  8. Video details from Aurora; views to DynamoDB.
  9. New uploads queue transcode jobs in SQS.
  10. CloudWatch watches it all.
  11. The lesson plays.
Diagram 2: an illustrative AWS design for learning. YouTube does not necessarily run like this; see the sections above for what is publicly known. Open the diagram as an image (PNG) · WebP

YouTube versus our AWS design

PartYouTube (public info)Our AWS design
HostingGoogle data centresAWS, two AZs
TranscodingVCU chipsMediaConvert
DatabasesBigtable, SpannerAurora, DynamoDB
DeliveryGoogle edge + Global CacheCloudFront
MonitoringNot publicly sharedCloudWatch, X-Ray

Quick quiz: check what you learned

  1. What is YouTube's VCU?

    1. A custom video transcoding chip
    2. A video upload app
    3. A comment filter
    4. A database type
    Show answer

    A. The Video Coding Unit is a custom chip for transcoding.

  2. Which database does YouTube use for its data warehouse?

    1. Cassandra
    2. Bigtable
    3. MongoDB
    4. Oracle
    Show answer

    B. As of 2023 the YouTube Data Warehouse is built on Bigtable.

  3. What did YouTube build to scale MySQL?

    1. Kafka
    2. Hadoop
    3. Vitess
    4. Redis
    Show answer

    C. Vitess was created at YouTube in 2010.

  4. Where are Google Global Cache servers placed?

    1. Only in Google offices
    2. Inside users' phones
    3. In the Mumbai AWS region
    4. Inside internet providers
    Show answer

    D. Google Global Cache servers sit inside ISP networks.