System Design: Design YouTube

ByteByteGo · Beginner ·🏗️ Systems Design & Architecture ·10mo ago

Key Takeaways

The video discusses system design, specifically designing a system like YouTube, covering key components and considerations for building a scalable video sharing platform.

Full Transcript

Upload video, watch video. Sounds simple. YouTube processes 500 hours of video every minute. That's 30,000 hours of content uploaded every hour. The engineering behind this interface is complex. Let's design YouTube. Not the billion user version, but a smaller system that we can learn from. This video covers the core components. We'll focus on video upload and streaming. There's much more to YouTube. search, recommendations, comments, monetization. Each could be its own deep dive. Today, we'll build a foundation you can extend. Here are the requirements we'll focus on. People upload massive videos. A 10-minute 4K video ranges from 1.5 GB highly compressed to 30 GB in ProRes. When uploading huge videos, users expect resumable uploads. For viewing, playback must adapt to network condition in real time. When your connection drops from 25 megabit per second to 2 megabit per second, playback shouldn't stop. The upload challenge reveals the first design decision. We could route large videos through our API servers, configure streaming instead of buffering, increase time out from 30 seconds to 30 minutes, handle partial uploads is all solvable. But why make our servers handle gigabytes of pass through traffic when they could be serving actual API requests? There's a better pattern. use pre-signed URLs. Our API server generates a temporary signed URL that grants direct upload permission to blob storage. The client uploads straight to storage. Our server stay free to handle other work. Blob storage gives us another benefit. We get multiport uploads built in. The client splits the videos into chunks. Each chunk is 5 to 10 megabyte. It's small enough to upload quickly on slower connections. Large enough to minimize overhead. Each chunk get a SH 256 fingerprint. The client uploads chunks in parallel. Six chunks uploading simultaneously is common. This pattern appears in Dropbox, Google Drive, and backup services. Any system handling large files uses similar approaches. The processing pipeline presents a different challenge. Video transcoding burns massive compute cycles. User uploads videos in many different formats. iPhone record in HGVC. Android phones uses H.264. Someone uploads a 4K Pro file from Final Cut Pro. We need these videos playable on every device. Old Android phones run ancient Android. Smart TVs from 2018, web browsers that haven't updated in years. The solution is a processing pipeline that converts one video into many versions. We generate multiple resolutions from 2160p down to 240p. We need so many because network conditions and device speeds vary widely. Someone on fiber with a fast device needs 4K. Someone on 3G with an ancient phone needs 240p. Then consider codecs. H264 works everywhere but uses more bandwidth. VP9 saves bandwidth but older devices can decode it. AV1 saves even more bandwidth but needs powerful hardware. We encode in all three. Next, we package these in containers. MP4 for maximum compatibility. Webb for web optimization. Now one upload becomes 15 to 20 files. How do we process efficiently? Model the workflow as a DAG. DAG stands for the directed as cyclic graph. Each processing step is a note. Dependencies are edges. The asyclic part matters. It ensures task can complete without circular dependencies. First split the video into segments. Videos have key frames every two to 10 seconds. These frames send alone without referencing others. Split a key frames now use segment processes independently. The workflow splits into multiple streams. Video, audio, and metadata each take their own path through the system. Video segments fan out to hundreds of workers while one machine transcodes segment one to 1080p. Another handles segment 2 to 720p. Audio processing runs in parallel on different hardware. Thumbnail generation and subtitle extraction happen on their own dedicated workers. This is the power of modeling work as a DAG. One video becomes hundreds of parallel tasks across a worker farm. As each task completes, results flows to the next stage. Sequential processing would take hours. Parallel processing completes in minutes. Now streaming. Modern video streaming uses adaptive bitray streaming. The video player doesn't download one file. It downloads segments, small chunks of videos, each a few seconds long. When network bandwidth is high, the player fetches 1080p segment. When bandwidth drops, it switches to 480p segments. The transition is usually seamless. This work through manifest files. The primary manifest lists all available formats. Each format then has its own media manifest with URLs for every segment. The player reads manifests, monitors bandwidth using the download speed of the recent segments, and fetches the probate segments. All this happened invisibly. The player makes HTTP range requests. Give me 1,000 to 2,000 of segment five of the 720p version. This enables instance seeking to jump to minute 47. The player calculates which segments to fetch. These segments are stores in CDN's, content delivery networks. Popular videos cache across edge servers worldwide. A viewer in Tokyo get segments from Tokyo, not California. Geographic proximity means lower latency, better streaming. We've just scratched the surface. Several areas deserve deeper exploration. The hot video problems challenges every video platform. When one video goes viral, millions request it simultaneously. We need metadata caching and database hotspot prevention. Cost optimization requires trade-offs. Do we transcode everything immediately or popular formats first? Should rare formats use ondemand transcoding? When do we migrate to code storage? Pipeline optimization can improve latency. Stop processing segments as they arrive instead of waiting for complete upload. Pipeline to upload and processing for faster availability. We could explore geographic CDN placement, readwrite ratios or lazy transcoding strategies. Each topic could be its own deep dive, but the fundamentals remain the same. What makes this design work at scale? Direct uploads keep servers free for actual logic. DAX transforms sequential bottlenecks into parallel workflow. Adaptive streaming ensures smooth playback regardless of network conditions. Once we understand these principles, we see them everywhere. Large file sharing, machine learning pipelines, and live streaming all build on these same foundations. Ready to ace your next technical interview? Join our community where we offer comprehensive courses on system design, coding, behavioral questions, machine learning, and object-oriented design. Learn more at bitebico.com.

Original Description

We just launched the all-in-one tech interview prep platform, covering coding, system design, OOD, and machine learning. Launch sale: 50% off. Check it out: https://bit.ly/bytebyego-yt-desc
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from ByteByteGo · ByteByteGo · 0 of 60

← Previous Next →
1 What happens when you type a URL into your browser?
What happens when you type a URL into your browser?
ByteByteGo
2 System Design: Why is Kafka fast?
System Design: Why is Kafka fast?
ByteByteGo
3 System Design: How to store passwords in the database?
System Design: How to store passwords in the database?
ByteByteGo
4 Big Misconceptions about Bare Metal, Virtual Machines, and Containers
Big Misconceptions about Bare Metal, Virtual Machines, and Containers
ByteByteGo
5 FAANG System Design Interview: Design A Location Based Service (Yelp, Google Places)
FAANG System Design Interview: Design A Location Based Service (Yelp, Google Places)
ByteByteGo
6 Scan To Pay in 2 Minutes
Scan To Pay in 2 Minutes
ByteByteGo
7 Consistent Hashing | Algorithms You Should Know #1
Consistent Hashing | Algorithms You Should Know #1
ByteByteGo
8 System Design: Why is single-threaded Redis so fast?
System Design: Why is single-threaded Redis so fast?
ByteByteGo
9 HTTP/1 to HTTP/2 to HTTP/3
HTTP/1 to HTTP/2 to HTTP/3
ByteByteGo
10 What Is REST API? Examples And How To Use It: Crash Course System Design #3
What Is REST API? Examples And How To Use It: Crash Course System Design #3
ByteByteGo
11 The Secret Sauce Behind NoSQL: LSM Tree
The Secret Sauce Behind NoSQL: LSM Tree
ByteByteGo
12 Bloom Filters | Algorithms You Should Know #2 | Real-world Examples
Bloom Filters | Algorithms You Should Know #2 | Real-world Examples
ByteByteGo
13 Back-Of-The-Envelope Estimation / Capacity Planning
Back-Of-The-Envelope Estimation / Capacity Planning
ByteByteGo
14 How To Choose The Right Database?
How To Choose The Right Database?
ByteByteGo
15 How Does Live Streaming Platform Work? (YouTube live, Twitch, TikTok Live)
How Does Live Streaming Platform Work? (YouTube live, Twitch, TikTok Live)
ByteByteGo
16 Latency Numbers Programmer Should Know: Crash Course System Design #1
Latency Numbers Programmer Should Know: Crash Course System Design #1
ByteByteGo
17 What Are Microservices Really All About? (And When Not To Use It)
What Are Microservices Really All About? (And When Not To Use It)
ByteByteGo
18 How Does Apple/Google Pay Work?
How Does Apple/Google Pay Work?
ByteByteGo
19 Proxy vs Reverse Proxy (Real-world Examples)
Proxy vs Reverse Proxy (Real-world Examples)
ByteByteGo
20 What is API Gateway?
What is API Gateway?
ByteByteGo
21 What Is GraphQL? REST vs. GraphQL
What Is GraphQL? REST vs. GraphQL
ByteByteGo
22 What Is Single Sign-on (SSO)? How It Works
What Is Single Sign-on (SSO)? How It Works
ByteByteGo
23 What Is A CDN? How Does It Work?
What Is A CDN? How Does It Work?
ByteByteGo
24 What is RPC? gRPC Introduction.
What is RPC? gRPC Introduction.
ByteByteGo
25 SSL, TLS, HTTPS Explained
SSL, TLS, HTTPS Explained
ByteByteGo
26 FANG Interview Question | Process vs Thread
FANG Interview Question | Process vs Thread
ByteByteGo
27 What is OSI Model | Real World Examples
What is OSI Model | Real World Examples
ByteByteGo
28 CAP Theorem Simplified
CAP Theorem Simplified
ByteByteGo
29 Kubernetes Explained in 6 Minutes | k8s Architecture
Kubernetes Explained in 6 Minutes | k8s Architecture
ByteByteGo
30 CI/CD In 5 Minutes | Is It Worth The Hassle: Crash Course System Design #2
CI/CD In 5 Minutes | Is It Worth The Hassle: Crash Course System Design #2
ByteByteGo
31 Why Is System Design Interview Important?
Why Is System Design Interview Important?
ByteByteGo
32 8 Key Data Structures That Power Modern Databases
8 Key Data Structures That Power Modern Databases
ByteByteGo
33 System Design Interview: A Step-By-Step Guide
System Design Interview: A Step-By-Step Guide
ByteByteGo
34 Top 5 Redis Use Cases
Top 5 Redis Use Cases
ByteByteGo
35 Debugging Like A Pro
Debugging Like A Pro
ByteByteGo
36 But What Is Cloud Native Really All About?
But What Is Cloud Native Really All About?
ByteByteGo
37 Everything You Need to Know About DNS: Crash Course System Design #4
Everything You Need to Know About DNS: Crash Course System Design #4
ByteByteGo
38 The Most Beloved Burger for Developers
The Most Beloved Burger for Developers
ByteByteGo
39 10+ Key Memory & Storage Systems: Crash Course System Design #5
10+ Key Memory & Storage Systems: Crash Course System Design #5
ByteByteGo
40 Cache Systems Every Developer Should Know
Cache Systems Every Developer Should Know
ByteByteGo
41 Top 7 ChatGPT Developer Hacks
Top 7 ChatGPT Developer Hacks
ByteByteGo
42 How ChatGPT Works Technically | ChatGPT Architecture
How ChatGPT Works Technically | ChatGPT Architecture
ByteByteGo
43 10 Key Data Structures We Use Every Day
10 Key Data Structures We Use Every Day
ByteByteGo
44 Top 7 Most-Used Distributed System Patterns
Top 7 Most-Used Distributed System Patterns
ByteByteGo
45 Secret To Optimizing SQL Queries - Understand The SQL Execution Order
Secret To Optimizing SQL Queries - Understand The SQL Execution Order
ByteByteGo
46 Amazon Prime Video Ditches AWS Serverless, Saves 90%
Amazon Prime Video Ditches AWS Serverless, Saves 90%
ByteByteGo
47 Top 6 Most Popular API Architecture Styles
Top 6 Most Popular API Architecture Styles
ByteByteGo
48 Top 5 Most-Used Deployment Strategies
Top 5 Most-Used Deployment Strategies
ByteByteGo
49 How Discord Stores TRILLIONS of Messages
How Discord Stores TRILLIONS of Messages
ByteByteGo
50 Uncovering Stack Overflow's Shocking Architecture
Uncovering Stack Overflow's Shocking Architecture
ByteByteGo
51 OAuth 2 Explained In Simple Terms
OAuth 2 Explained In Simple Terms
ByteByteGo
52 Demystifying the Unusual Evolution of the Netflix API Architecture
Demystifying the Unusual Evolution of the Netflix API Architecture
ByteByteGo
53 1 Year Of YouTube | Best System Design Series
1 Year Of YouTube | Best System Design Series
ByteByteGo
54 DevOps vs SRE vs Platform Engineering | Clear Big Misconceptions
DevOps vs SRE vs Platform Engineering | Clear Big Misconceptions
ByteByteGo
55 Top 7 Ways to 10x Your API Performance
Top 7 Ways to 10x Your API Performance
ByteByteGo
56 Why Google and Meta Put Billion Lines of Code In 1 Repository?
Why Google and Meta Put Billion Lines of Code In 1 Repository?
ByteByteGo
57 Git MERGE vs REBASE: Everything You Need to Know
Git MERGE vs REBASE: Everything You Need to Know
ByteByteGo
58 Top 6 Load Balancing Algorithms Every Developer Should Know
Top 6 Load Balancing Algorithms Every Developer Should Know
ByteByteGo
59 Algorithms You Should Know Before System Design Interviews
Algorithms You Should Know Before System Design Interviews
ByteByteGo
60 Top 5 Most Used Architecture Patterns
Top 5 Most Used Architecture Patterns
ByteByteGo

The video teaches system design principles by walking through the design of a YouTube-like platform, covering key considerations for scalability and performance. Viewers learn how to approach system design problems and prepare for tech interviews. The lesson is practical and hands-on, with a focus on real-world applications.

Key Takeaways
  1. Identify key components of a video sharing platform
  2. Consider scalability and performance requirements
  3. Design a system architecture
  4. Choose appropriate technologies and tools
  5. Prepare for common system design interview questions
💡 Scalability and performance are critical considerations when designing a video sharing platform like YouTube.

Related Reads

📰
7 Rust Patterns That Turn Juniors Into Confident Seniors
Learn 7 Rust patterns to boost confidence and skills, transforming junior developers into seniors
Medium · Programming
📰
Learning Go as a Ruby Developer # 1: How Go Programs Actually Run
Learn how Go programs run and how it compares to Ruby, and why understanding this matters for effective programming
Dev.to · Shrouk Abozeid
📰
Sprunki Phase 8 vs Phase 9: A Systems Design Breakdown
Learn how two rhythm-game phases with the same interaction can create distinct experiences through systems design
Dev.to · yuliang zhang
📰
Next.js vs Astro in 2026: Which Should You Actually Use?
Learn when to use Next.js vs Astro for your web development projects in 2026 and why it matters for your application's performance and scalability
Dev.to · TheKitBase
Up next
9-Step Software Architect Roadmap 2026 | System Design | #shorts
SCALER
Watch →