Skip to content

Case Study 4 — Design YouTube

Problem: Design a video-sharing platform like YouTube supporting 2B+ users, 500+ hours of video uploaded per minute, and global streaming with search and recommendations.


TypeRequirement
FunctionalUpload video, transcode, stream, search, comment, like/dislike, subscribe, channel, playlists
Non-Functional< 2s playback startup, 99.99% availability, 500+ hours/min upload, 1B+ hours watched daily

MetricValue
Monthly active users2B+
Video upload per minute500+ hours
Total video catalog1B+ videos
Daily watch time1B+ hours
Storage per day500 hr/min × 60 × 24 = 720K hours/day × ~500 MB/hour (compressed)

flowchart TB
subgraph Upload["Upload Path"]
UserUpload["📤 User Upload"]
UploadSrv["Upload Service"]
S3["S3 / Blob Store<br/>Master files"]
end
subgraph Process["Processing Path"]
Queue["Processing Queue"]
Transcoder["Transcoder Farm"]
Thumbnail["Thumbnail Generator"]
QA["Quality Analysis"]
end
subgraph Serve["Serving Path"]
CDN["Google Global Cache CDN"]
Edge["Edge Servers"]
API["API Servers"]
end
subgraph Storage["Storage"]
BigTable["BigTable<br/>Video metadata"]
Index["Search Index<br/>Elasticsearch"]
Cache["Cache Layer<br/>Popular videos"]
end
UserUpload --> UploadSrv --> S3
S3 --> Queue --> Transcoder
Transcoder --> CDN
API --> Cache --> BigTable
API --> Index
style Upload fill:#3b82f6,color:#fff
style Process fill:#7c3aed,color:#fff
style Serve fill:#059669,color:#fff
style Storage fill:#f59e0b,color:#fff

1. Upload Service

sequenceDiagram
participant User as YouTuber
participant UpSrv as Upload Service
participant S3 as Blob Store
participant Queue as Processing Queue
User->>UpSrv: Start upload (resumable)
UpSrv->>UpSrv: Assign video ID
UpSrv->>S3: Store in chunks
S3-->>UpSrv: Chunk saved
UpSrv-->>User: ✅ Chunk received
Note over User,S3: Resumable upload — can pause/resume
User->>UpSrv: Finalize upload
UpSrv->>S3: Assemble chunks → single file
UpSrv->>Queue: New video ready for processing
UpSrv-->>User: 201 Created (processing in background)

2. Transcoding Pipeline

StepPurpose
DemuxSplit video, audio, subtitles from container
DecodeDecode video to raw frames
TranscodeEncode to H.264, VP9, AV1 at various resolutions
ThumbnailsExtract thumbnails at key points
Quality analysisCheck for issues (blurry, audio sync)
PackageSegment into DASH/HLS chunks

AspectYouTubeNetflix
ContentUser-generatedProfessional (studio)
Upload volume500 hr/minNew titles weekly
ProcessingMust process instantlyCan batch process
RecommendationBased on watch history + trendsBased on viewing history + ratings
MonetizationAds + Premium + MembershipsSubscription only

AspectApproachTrade-off
Video processingAsync (enqueue, process, notify)Delay from upload to publish
CDNGoogle Global CacheMassive infrastructure cost
SearchElasticsearch + custom rankingComplex indexing pipeline
CommentsSeparate service, paginatedHard to moderate at scale

  • Upload = resumable chunked uploads to blob store, then async processing
  • Transcoding = convert to multiple formats/resolutions (H.264, VP9, AV1)
  • CDN = Google’s global cache network — videos served from nearest edge
  • Search = Elasticsearch with custom ranking signals (views, engagement, freshness)
  • Recommendation = deep neural network trained on watch history
  • Comments = separate service with pagination and moderation pipeline
  • Ad insertion = server-side ad insertion during streaming (can’t be skipped)