๐ŸŽฌ
Video Platform
System Design
VOD Ingestion PlatformHigh-Throughput TranscodingGlobal Edge Caching

Design a Video Streaming Service

YouTube is a global online video-sharing platform where users can upload, view, and share content. Netflix is a global subscription-based streaming service delivering a vast library of TV shows and movies. Both platforms require bulletproof, planet-scale streaming architectures to deliver stutter-free experiences.

Beginner's Guide

How YouTube & Netflix Work (For Beginners)

๐Ÿ’ก
In Plain Terms

Both YouTube and Netflix deliver streaming video, but their background workloads are entirely different.

YouTube is a public stage. Anyone can upload video files at any time (User-Generated Content). The system must quickly ingest, transcode, and catalog these raw uploads so viewers can discover and watch them globally in seconds.

Netflix is a curated cinema. Only administrators publish content in scheduled, high-quality batches. The engineering focus is strictly on caching and delivering a zero-lag, stutter-free playback experience to viewers globally.

The Post-Office Analogy: Imagine a global post office. An author writes a heavy book (raw video upload). The central office slices it up into small 6-second video segments (segmentation), prints them in multiple resolutions like 1080p or 4K (transcoding), and ships them to thousands of local stands worldwide (CDNs). When a reader wants to read, they fetch segment 1, and while reading, their desk automatically fetches the next few segments based on how fast they read (adaptive streaming).

In this guide, we will design a highly scalable Video on Demand (VOD) service. We will explore how to balance the write-heavy creator pipeline (uploading, transcoding, and processing) with the read-heavy distribution network (CDN edge-caching and adaptive chunk playback) to support hundreds of millions of concurrent viewers worldwide.

Step 01

Functional Requirements

Must-Have Features

๐Ÿ“ค 1. Upload & Ingest

  • โœ“
    Chunked Video Upload: System must support uploading large video payloads (up to 20GB) without consuming memory limits on application servers.
  • โœ“
    Upload Pause & Resume: CRITICAL REQUIREMENT: System must support fault-tolerant uploads. If a creator's connection drops, the upload must resume from the last successful chunk without restarting.
  • โœ“
    Creator Dashboard Upload Status: Allows video publishers to monitor active upload completion and processing states.

๐Ÿ“บ 2. Playback & Streaming

  • โœ“
    Adaptive Bitrate Streaming: Transports media seamlessly using segmented streaming protocols across varying client network profiles.
  • โœ“
    Signed Playback Indexing: Grants authenticated clients geo-restricted playlist maps tied to transient IP keys.

๐Ÿ” 3. Search & Discovery

  • โœ“
    Fuzzy Text Vector Search: Leverages index catalogs to lookup video records, matching descriptions and metadata instantly.
  • โœ“
    Autocomplete Type-ahead Suggestions: Generates high-speed query-matching listings in under 50ms based on historical text models.

Out of Scope & Future Nice-to-Haves

  • โœ• Live-streaming pipeline ingestion (focus is strictly VOD architecture).
  • โœ• Turnkey digital content licensing and copyright audit tools.
  • โœ• Payment splits or recurring subscriber subscription billing structures.
  • โœ• Real-time view counter aggregations (specific implementations like stream processing engines and batch state layers are deferred to the scaling/bottlenecks section).
  • โœ• Content Creator Studio with in-browser clip trims.
  • โœ• Real-time chat overlay for premier view countdowns.
  • โœ• Interactive dynamic ad inserts mapping client sessions.
  • โœ• Multi-channel playlist groupings and video collections.
Step 02

Non-Functional Requirements

To build a bulletproof streaming platform, we focus strictly on measurable targets. We separate actual physical performance targets (Latency, Availability, and Durability) from our structural and database engine designs:
โšกLatency
  • โ€บPlayback startup: < 200ms globally
  • โ€บEdge segment retrieval: < 30ms
  • โ€บPlayer buffering recovery switches in < 1s
๐Ÿ›กAvailability
  • โ€บUptime target: 99.99%
  • โ€บEdge CDNs degrade gracefully to regional rings
  • โ€บDecoupled architecture protects video playing during upload spikes
๐Ÿ“ˆScale
  • โ€บSupports 500M Daily Active Users
  • โ€บAccepts over 500 hours of uploaded media/min
  • โ€บEvent-driven asynchronous video transcoding
โš–๏ธConsistency
  • โ€บStrict consistency for profile changes and uploads
  • โ€บEventual consistency (< 3s) for playlists and search
๐Ÿ”‘Security
  • โ€บSigned URL hashes tied to client IPs
  • โ€บDRM encryption loops protecting licensed video content
๐Ÿ’พDurability
  • โ€บ11-nines reliability via durable cloud storage
  • โ€บResumable uploads to prevent data loss on network drop
Step 03

Back-of-the-Envelope Estimation

Throughput Math

MetricCalculated TargetUnderlying Formula
Global Footprint500M DAUsActive system base
Peak Concurrent streams25M users5% of daily active footprint at peak
Videos created / day5.4M records720,000 hrs uploaded / 8 min length
Average Query Rate17,400 QPS1.5B streams / 86,400 seconds
Peak Query Burst87,000 QPS5x average load multiplier

Storage & Network Math

Storage Ingestion Rate
Calculates average 5 transcoding ladders (2.25 GB per video output)
12 PB / day
Year-1 Catalog Footprint
Incremental database growth before cold archive sweeps
4.3 EB
Peak Streaming Output
Concurrent 25M active streams ร— average 3 Mbps bitrate
75 Tbps
Transcode Instance Farm
Based on 360,000 active GPU execution hours per day
45,000 GPUs
Step 04

High-Level Design

๐Ÿ’ก
In Plain Terms

The pipeline divides clean duties. Crucially, video transcoding is NEVER called synchronously through the API Gateway. Doing so would cause HTTP timeouts since processing a video takes minutes or hours.

When a video is sent: it hits the Upload Service which tells our storage where to put the heavy raw bytes directly. Once the storage confirms it has the file, it drops a message on the Kafka event bus. This asynchronous queue acts as a buffer and independently alerts the background conversion workers to start pulling jobs, completely decoupling heavy processing from the fast web API.

On the playback side, viewers query the Streaming Service to get a signed, customized chapters map. From that point forward, the viewer talks strictly to close-by CDN Edge nodes to fetch individual chapters, keeping our core databases fast and quiet.

Our services run statelessly. Dynamic API calls are processed via the gateway layers, and all heavy assets bypass the application servers entirely by writing directly to S3 bucket keys:

๐ŸŽฌ System Data Flow Direction: Left to Right
Client Gateways App Core Storage
CLIENT TIERSDELIVERY & GATEWAYSCORE SERVICESASYNC & CACHINGPERSISTENT DBsWeb BrowserMobile AppSmart TVEdge CDNWAF ProxyLoad BalancerAPI GatewayAuth SvcUpload SvcStream SvcSearch SvcTranscode SvcApache KafkaRedis ClusterS3 StorageMetadata DBElasticsearch

๐Ÿ‘† Click components to trace architecture lineages

๐Ÿ›ก๏ธ Networking Breakdown: WAF vs. Load Balancer vs. API Gateway

In a large-scale architecture, the Web Application Firewall (WAF), Load Balancer (LB), and API Gateway (APIGW) do not represent the same server. They are distinct, decoupled infrastructure layers operating sequentially:

1. WAF Proxy (Edge Security)
OSI Layer 7 Security

Located nearest to the network perimeter (often integrated at the CDN layer). Its sole job is traffic inspection: filtering SQL injection, cross-site scripting (XSS), bot scraper clusters, and Layer-7 DDoS floods before they can even touch internal services.

2. Load Balancer (Infrastructure Entry)
High-Availability Distribution

A highly specialized appliance (such as AWS ALB or an NGINX ring) optimized to route massive traffic. It distributes the filtered, decrypted HTTPS payloads across a cluster of API Gateway servers, acting as the primary point of failure protection.

3. API Gateway (App Orchestration)
Stateless Routing & Logic

The entrance to your internal microservice mesh. Unlike LBs, the API Gateway runs custom software logic. It coordinates downstream calls, routes paths to individual microservices (e.g., /upload vs. /search), checks request rate-limits, and communicates directly with the Auth Service.

๐Ÿงฉ The Core Concept: Slicing the Loaf of Bread

In system engineering, we never send a single raw video file (which could be several gigabytes) directly down a wire to a user's phone. That would cause massive buffer stalls and high data usage!

Instead, we treat a video like a loaf of bread. During the transcoding phase, we slice the video into small, 6-second segment files (like thin slices of bread) formatted in fragmented MP4 (fMP4) or TS containers.

๐Ÿ“1 Raw Movie
โ†’
โš™๏ธTranscoder
โ†’
seg_01.m4s
seg_02.m4s
seg_03.m4s

When you hit play on YouTube or Netflix, your player fetches a map index file (called an HLS playlist or manifest). It then requests these individual 6-second slices one-by-one. If your Wi-Fi speeds slow down suddenly, the player seamlessly upshifts or downshifts the resolution of the *next* slice without crashing your viewing experience!

Direct-to-S3 Upload Path
Client sends video configurations -> Upload service validates JWT -> generates presigned multi-part S3 keys -> client streams chunks directly.
Kafka Event Bus Spine
Durable log distributing upload notifications, transcode milestones, analytics heartbeats, and database updates.
GPU Auto-Scaling Farm
NVIDIA accelerated worker clusters (Kafka Consumers) scale based on queue lag to process multi-format ladders.
Multi-Tier Cache
Three caching layers: local Guava heap storage, distributed Redis arrays, and global Edge CDNs.
Segmented Streams (fMP4)
Slices files into 6s standalone segments. Solves network switches instantly without interrupting playback.
Tokenized CDN Signatures
Prevents stream link sharing. CDN edge servers confirm token HMAC hashes and client IP bindings locally.

High-Level CAP Strategy

User Profiles (RDBMS)CP (Consistent / Partition)

Strict transactional profile mapping. Relational tables guarantee absolute consistency for account state management.

Metadata DB (NoSQL)AP (Available / Partition)

Eventual consistency of metadata. Allows write speeds to scale infinitely; index delays of 1-3 seconds are visually imperceptible.

โš–๏ธ Architectural Alternatives & Design Decisions

S3 Intelligent Tiering vs. Static Storage Policies
๐ŸŽฏChosen: Intelligent Tiering (Hot/Cold Archival Management)
โœ“ Pro: Reduces raw media costs by up to 50% by automatically shifting older, unviewed long-tail assets to AWS Glacier (a deep, cold storage tier designed for cheap, long-term archival).
โœ— Con: Restoring archived objects can introduce retrieval latency if users suddenly request a video that hasn't been watched in years.
In-house CDN Infrastructure vs. Third-Party CDNs (Akamai/Fastly)
๐ŸŽฏChosen: Third-Party CDNs (Edge PoPs) + Layer 2 Origin Shield
โœ“ Pro: Eliminates immense capital expenditure (CapEx) of building global physical data centers while keeping edge retrieval times under 30ms.
โœ— Con: Puts us at the mercy of egress network traffic fees from cloud partners at extreme global scales.
Direct-to-S3 Upload vs. Gateway Proxied Ingest
๐ŸŽฏChosen: Direct-to-Storage Ingestion (Presigned Multi-Part Chunk Uploads)
โœ“ Pro: Completely bypasses application servers, eliminating CPU and network memory constraints during massive creator spikes.
โœ— Con: Increases orchestrational complexity on client player engines to manage concurrent presigned URL mapping states.
Pre-transcoding All Video Ladders vs. On-Demand Transcoding
๐ŸŽฏChosen: Pre-transcoding All Quality Ladders (Asynchronous Encoding Paths)
โœ“ Pro: Guarantees instantaneous playback startup metrics (< 200ms) globally since target segment slices are fully cached and waiting.
โœ— Con: Increases the active storage footprint by 4-5x for unviewed long-tail creator catalog assets.
Symmetric vs. Asymmetric Transcode Triggering
๐ŸŽฏChosen: Asymmetric Transcode Triggering (Event-Driven Kafka Consuming)
โœ“ Pro: Event-driven asynchronous consumer loops protect server clusters from cascade bottlenecks when heavy raw files land.
โœ— Con: Forces creators to check active processing status indicators on their dashboard while worker queues churn.
Active-Active Global Databases vs. Partitioned Region Masters
๐ŸŽฏChosen: Partitioned Region Masters + High-Read Replicas
โœ“ Pro: Provides predictable transactional writes and clean consistency models without high risks of active-active split-brain collisions.
โœ— Con: Cross-region users accessing foreign home nodes can face slight read-path delays due to replication lag limits.
Step 05

Data Model

1:N1:Nusers (PG)๐Ÿ”‘id UUIDusername VARCHARemail VARCHARpassword_hash TEXTcreated_at TIMESTAMPTZmetadata_db (DynamoDB)๐Ÿ”‘video_id string๐Ÿ”—creator_id stringtitle stringstatus ENUMduration numbercreated_at numbervideo_files (DynamoDB)๐Ÿ”‘file_id string๐Ÿ”—video_id stringquality stringcodec stringmanifest_url string

User Profiles (PostgreSQL)

Used strictly for structured authentication and transaction histories requiring ACID guarantees.

Metadata DB (DynamoDB NoSQL)

Stores video catalog data. Sharded across wide-key partitions to support hundreds of millions of objects globally.

โšก Metadata Cache (Redis)

Because a single viral video's metadata might be requested millions of times an hour, direct DB reads would bottleneck. We place a distributed Redis Cluster in front of the Metadata DB to absorb 99% of read traffic.

โš–๏ธ Architectural Alternatives & Design Decisions

Relational SQL (Postgres) vs. Key-Value NoSQL (DynamoDB) for Metadata
๐ŸŽฏChosen: DynamoDB (Key-Value NoSQL)
โœ“ Pro: Provides infinite horizontal scale-out capabilities and seamless multi-region active-active replication to support massive creator upload rates globally.
โœ— Con: Lacks complex JOIN capabilities, meaning related data (like fetching a creator's profile alongside their video) requires multiple app-level queries.

Elasticsearch Index Mapping

Transforms metadata records into high-performance search-as-you-type indices. By defining the primary search target as a search_as_you_type type field, Elasticsearch automatically breaks text inputs down into structured edge n-grams (e.g. "sy", "sys", "syst", "system").

This indexing step eliminates the need for expensive, platform-crashing database wildcard regex scans (LIKE %query%) in production. Instead, autocomplete responses resolve in O(1) time complexity directly from fast pre-tokenized memory banks.

Step 06

API Design

RESTJSON over HTTPSToken Authorized

Begins chunked multi-part session. Requires Bearer Token auth. Returns presigned URL map for TUS.

REQUEST BODY
json
HEADERS:
Authorization: Bearer eyJhbGci...

BODY:
{
  "title": "My Scale System Guide",
  "file_size": 2516582400,
  "mime_type": "video/mp4"
}
RESPONSE
json
HTTP 201 Created
{
  "upload_id": "ul_01F9A...",
  "video_id": "vid_01F9A...",
  "chunk_size": 5242880,
  "part_urls": [
    { "part_number": 1, "url": "https://s3.amazonaws.com/raw/part1?sig=..." }
  ]
}
KNOWN ERRORS
400 Bad Request โ€“ Unsupported codec401 Unauthorized413 Payload Too Large

โš–๏ธ Architectural Alternatives & Design Decisions

REST vs. GraphQL for Media APIs
๐ŸŽฏChosen: REST (Representational State Transfer)
โœ“ Pro: Highly cacheable at the Edge CDN layer based on URL structures. Standard HTTP verbs align perfectly with distributed caching semantics.
โœ— Con: Can lead to over-fetching compared to GraphQL if client screens need specific, deeply nested metadata properties.
Search Pagination: Offset vs. Cursor (Keyset)
๐ŸŽฏChosen: Cursor-Based Pagination
โœ“ Pro: Scales efficiently on massive datasets (e.g. searching 'tutorial' which has 500k results) without the deep-query performance penalty of `OFFSET 100000`.
โœ— Con: Slightly more complex for client UI to implement (can't easily jump straight to 'Page 50').
Step 07

Deep Dive Subsystems

Direct Ingestion via TUS

๐Ÿ’ก
In Plain Terms
Instead of uploading a massive 20GB video file all at once (where a brief Wi-Fi drop forces you to restart from scratch), the TUS protocol acts like a bookmark. It splits the file into 5MB chunks. If your internet disconnects on chunk 300, it resumes from chunk 300 immediately upon reconnecting.

The client negotiates with the Upload Service to generate secure, presigned S3 URLs. The client then pushes 5MB chunks directly to the S3 bucket:

VOD Upload Swimlanes

ClientAPI GatewayUpload SvcS3 StorageKafka BusTranscoder (Consumer)POST /initiate-uploadAuthorizes and mapsCreateMultipartUpload()Presigned URL arrayUpload map responsePUT chunk[0..N] (Parallel)POST /completeCompleteMultipartUpload()Publish 'video.uploaded' eventConsume & Transcode asynchronously

โš™๏ธ Logical Flow of Chunked Uploads:

  1. Slice the File: The client splits the heavy video payload into standardized chunks (e.g., 5MB each).
  2. Concurrent Uploads: The player engine spawns a worker pool to upload 4 to 8 chunks simultaneously, maximizing the client's available network bandwidth.
  3. Direct S3 PUT: Each chunk is sent directly to the S3 bucket using its unique pre-signed URL, completely bypassing the application server's memory and CPU limits.
  4. Commit & Confirm: Once all part hashes (ETags) are successfully returned, the client sends a final webhook to the Upload Service, instructing it to stitch the parts together and trigger the processing pipeline.

Internal Lifecycle State machine

Init UploadParts CompletedKafka TriggerQualities OKJob ErrorClient RetryDRAFTUPLOADINGUPLOADEDTRANSCODINGPUBLISHEDFAILED

GPU Video Transcoding DAG (Directed Acyclic Graph)

To convert high-definition raw videos into streamable packets without blocking system threads, we split tasks into an independent **Directed Acyclic Graph (DAG)**. This ensures demuxing, multi-resolution scaling, image extraction, and watermark additions proceed in parallel pathways with isolated failure recovery:

Video Processing Directed Acyclic Graph (DAG) Subsystem

1. Ingest Raw File
Validates headers & logs state.
2. Demuxing
Separates video and audio streams.
GPU Transcode 4K
Hardware async rendering to UHD.
GPU Transcode 1080p
Hardware rendering to crisp HD.
Apply Watermark
Embeds dynamic DRM/brand overlays.
3. Segment & Mux
Slices into static 6-sec fMP4 chunks.
4. Write Manifest
Compiles HLS .m3u8 routing indexes.
We leverage NVIDIA hardware-accelerated encodings (h264_nvenc) to execute these tasks concurrently. Why hardware acceleration? Dedicated physical silicon ASIC block arrays on modern GPUs process pixel conversions and video compression matrix math much faster and more efficiently than standard multi-core CPUs. Offloading raw framing computations to these dedicated circuits lowers total CPU utilization by up to 95% and reduces infrastructure costs tenfold, enabling concurrent rendering of multiple 4K/1080p target streaming ladders.

โš™๏ธ Transcoder Output Configuration Goals:

  • Hardware Acceleration: Instructs the worker node to utilize the underlying NVIDIA GPU matrix for pixel processing instead of relying on CPU thread locking.
  • Perceptual Bitrate Limits: Constrains the maximum visual bitrate (e.g., 5000kbps for 1080p) to balance crisp visual quality with mobile bandwidth constraints.
  • Segmentation: Forces the output stream to slice exactly every 6 seconds into fragmented MP4 containers (.m4s).
  • Manifest Generation: Automatically compiles the HLS .m3u8 index file pointing to the newly generated 6-second slices.

Adaptive Bitrate (ABR) Controller

Implemented directly on the client player via standard BOLA buffer-driven logic. It monitors player buffer health and switches quality classes to prevent playback stutters:

๐ŸŽ›๏ธ Try It: ABR Simulator

Network Bandwidth (Mbps)8 Mbps

Simulates user's active download speed (e.g., dropping in a tunnel).

Player Forward Buffer (Seconds)25s

How much video is pre-downloaded ahead of the current playhead.

Target Quality
1080p

โš™๏ธ Buffer-Occupancy Decision Matrix:

  • Emergency Fallback: If the client's forward buffer drops critically low (e.g., < 5 seconds left to play), the engine immediately downshifts to the lowest quality (e.g., 360p) to prevent a playback stall.
  • Aggressive Upshift: If the client's forward buffer grows beyond a healthy threshold (e.g., > 40 seconds) and average bandwidth calculations comfortably exceed the next tier's bitrate requirements, the player seamlessly upshifts to a higher quality class (e.g., 1080p).
  • Steady State: In all other scenarios, the player maintains the current quality tier to prevent jarring visual fluctuations and conserve network battery.

Adaptive Streaming: HLS & MPEG-DASH

HTTP Live Streaming (HLS) and Dynamic Adaptive Streaming over HTTP (MPEG-DASH) are the backbone protocols of modern video delivery. They solve a critical problem: How do you stream a 5GB video smoothly over fluctuating 4G/5G mobile networks without forcing the user to download the whole file first?

๐Ÿ“„ 1. The Manifest (The Menu)

Instead of a single video file, the player downloads a lightweight text file (.m3u8 for HLS, .mpd for DASH). This acts as a menu, listing all available resolutions (4K, 1080p, 720p) and providing the specific URLs for their respective video segments.

๐ŸŽž๏ธ 2. The Segments (The Slices)

The transcoder slices the video into tiny 2 to 6-second chunks (usually Fragmented MP4 .m4s files). The player downloads these chunks one by one via standard HTTP port 443. This means it trivially passes through enterprise firewalls and caches perfectly on standard CDN edge nodes.

โš–๏ธ Architectural Alternatives & Design Decisions

HLS vs. MPEG-DASH
๐ŸŽฏChosen: Common Media Application Format (CMAF / fMP4)
โœ“ Pro: By using CMAF/fMP4 containers, we store the exact same underlying binary video slices on S3, but dynamically generate two different text manifests (.m3u8 for Apple iOS devices, .mpd for Android/Smart TVs), effectively halving our storage costs.
โœ— Con: Requires modern player engines; legacy hardware sets (very old Smart TVs) might require older TS container formats.

Multi-Tier Cache & Origin Shield

To support millions of global users viewing heavy media files, we establish a multi-tier cache to ensure high-performance and protect our origin storage databases from crashing under heavy read loads.

  • L1 - Edge CDN Caches: Thousands of points of presence (PoPs) globally positioned as physically close to the user as possible. Serves 95% of traffic.
  • L2 - Origin Shield (Regional Cache): Sits directly in front of our S3 bucket. It aggregates and handles cache misses from all Edge CDNs to prevent multiple PoPs from requesting the same file from S3 simultaneously.
Client PlayerL1: Edge CDNL2: Origin ShieldOrigin S3 DBGET segment (.m4s)Cache MissOrigin FetchReturn binary segment chunks back to player

๐Ÿ›ก๏ธ The Power of Request Collapsing

Without an Origin Shield, if a new viral video is published, 50 different Edge CDN nodes worldwide might experience a cache miss for the same exact seg_01.m4s file at the same time. This means they will fire 50 simultaneous read requests to S3, incurring high costs and risking rate limits.

With an Origin Shield in place, the shield intercepts those 50 identical misses. It places 49 requests in a brief holding queue, fetches the segment from S3 just once, caches it locally, and then serves the binary to all 50 waiting Edge nodes simultaneously. This technique is known as Request Collapsing.

Security, DRM, and Content Safety

Enterprise platforms must protect copyrighted material and maintain safe community standards. We integrate these directly into the pipeline:

๐Ÿ”’ Token Auth (JWT)

All API endpoints validate short-lived JSON Web Tokens (JWT). Segment requests rely on signed CDN URLs tied specifically to the user's IP address and a 5-minute expiry to prevent link sharing.

๐Ÿ›ก๏ธ DRM Encryption

Raw files are encrypted using AES-128 standard during transcoding. Decryption keys are handed out dynamically via hardware-backed DRM frameworks (Widevine for Android/Chrome, FairPlay for Apple).

๐Ÿ›‘ Profanity & Safety

Prior to being marked "Published", audio streams pass through an asynchronous ML transcription worker. Detected hate speech or extreme profanity flags the video for manual trust-and-safety review.

Step 08

Bottlenecks & Scaling Mitigations

๐Ÿ’ก
In Plain Terms
Scale breaks everything. At 500M DAUs, directly writing play events to a database or serving video segments from origin servers will crash the platform. We must implement rate limiters, circuit breakers, and batching layers to safeguard our services.
๐Ÿ“ก Mobile Upload Disconnects (Traveling)HIGH: Platform-Breaking

A creator uploading a 2GB file on a train loses cellular connection in a tunnel, halting the stream.

๐Ÿ› ๏ธ System Mitigations:
โ†’ Use TUS resumable upload protocol. The client maintains an active heartbeat.
โ†’ Upon reconnection, the client queries S3 for the last successfully stored ETag chunk, instantly resuming the upload from the exact byte it left off without restarting.
๐Ÿ”ฅ Hot Celebrity Content Stamps (Thundering Herd)HIGH: Platform-Breaking

An account with 10M subscribers publishes a video. A 'thundering herd' occurs when millions of viewers click the video simultaneously. Because it's brand new, it isn't in the Edge CDN cache yet, meaning millions of simultaneous requests hit the origin storage, potentially crashing it.

๐Ÿ› ๏ธ System Mitigations:
โ†’ Pre-warm Edge CDN caches: Query subscriber registers upon publishing. If subs > 100K, pre-warm the first 3 segments of all qualities.
โ†’ Implement L2 Regional Origin Shields to merge redundant, concurrent S3 read calls into a single query via request collapsing.
๐Ÿ’พ Storage Cost ExplosionMEDIUM: Performance Degrading

The infinite growth of uploaded UGC videos quickly balloons S3 storage costs.

๐Ÿ› ๏ธ System Mitigations:
โ†’ Apply S3 lifecycle policies: Migrate assets to Infrequent Access (IA) at 30 days, then to cold Glacier at 180 days.
โ†’ Automate the cleanup of older, unpopular 4K transcoded folders to reclaim disk space.
๐Ÿ“Š Transcoding Pipeline CongestionMEDIUM: Performance Degrading

A sudden influx of creators uploading content delays transcoding times, leaving videos stuck in a pending queue.

๐Ÿ› ๏ธ System Mitigations:
โ†’ Kubernetes KEDA scales GPU transcoding workers dynamically based on Kafka consumer lag metrics.
โ†’ Prioritize the transcoding queue: Route uploads from popular, verified creators to high-priority Kafka topics.

๐Ÿ“š Quiz: Test Your Understanding

Check how well you learned the Video Streaming system design. 20 questions.

Question 1 of 200 / 20 correct

Why does the system use direct-to-S3 chunked uploads (via the TUS protocol) instead of routing video bytes through the API Gateway?

VOD Streaming Platform Design Walkthrough ยท 8-Step Framework ยท Built for Staff Engineering Candidates
HLSMPEG-DASHTUS ProtocolNVIDIA TranscodingOrigin ShieldElasticsearchCassandraPostgreSQL Sharding

Stay Updated

Get interview tips, new problems, and career advice delivered to your inbox.

No spam, just interview tips and updates. Unsubscribe anytime.

ยฉ 2025 Upverse AI LLC. All rights reserved.

Made with care for professionals and students

    Built with v0