| Scale | Users | Uploads per second | Storage Needed | Processing Load | Network Bandwidth |
|---|---|---|---|---|---|
| Small | 100 | 1-2 | 10-20 GB | Single server, basic transcoding | 100 Mbps |
| Medium | 10,000 | 100-200 | 1-2 TB | Multiple processing workers, queue system | 1 Gbps |
| Large | 1,000,000 | 10,000+ | 100+ TB | Distributed processing, sharded storage | 10+ Gbps |
| Very Large | 100,000,000 | 100,000+ | 10+ PB | Massive distributed systems, CDN integration | 100+ Gbps |
Video upload and processing pipeline in HLD - Scalability & System Analysis
Start learning this pattern below
Jump into concepts and practice - no test required
At small to medium scale, the video processing workers become the first bottleneck. Video transcoding is CPU and memory intensive. A single server can handle only a limited number of concurrent video conversions.
As scale grows, storage I/O and network bandwidth also become bottlenecks due to large video file sizes.
- Horizontal scaling: Add more processing worker servers to handle transcoding in parallel.
- Queue system: Use message queues to manage upload and processing tasks asynchronously.
- Caching: Cache frequently accessed videos or thumbnails using CDN to reduce load.
- Sharding storage: Distribute video files across multiple storage nodes to improve I/O.
- CDN integration: Use Content Delivery Networks to serve processed videos closer to users, reducing bandwidth load on origin servers.
- Auto-scaling: Automatically add or remove processing resources based on upload traffic.
- At 10,000 uploads per second, assuming average video size 20 MB, storage needed per day: 10,000 * 20 MB * 3600 * 24 ≈ 17.28 TB/day (requires compression and retention policies).
- Processing: Each transcoding takes ~5 CPU-minutes; 10,000 uploads/sec means 50,000 CPU-minutes/sec -> requires massive parallelism.
- Network bandwidth: 10,000 uploads/sec * 20 MB = 200 GB/s (~1.6 Tbps) inbound bandwidth needed.
Start by clarifying the scale and requirements. Then identify the main components: upload, storage, processing, delivery. Discuss bottlenecks at each scale and propose targeted solutions. Use real numbers to justify your choices. Always mention asynchronous processing and CDN usage for video systems.
Your video processing system handles 1000 uploads per second. Traffic grows 10x to 10,000 uploads per second. What do you do first?
Answer: Add more processing worker servers horizontally and implement or scale the queue system to handle the increased load. Also, consider sharding storage and increasing network bandwidth to avoid bottlenecks.
Practice
Solution
Step 1: Identify the role of each component
The upload service handles receiving videos, the metadata database stores info, and CDN delivers content. The processing service converts videos.Step 2: Match the function to the question
Converting raw videos into multiple formats is done by the video processing service to ensure compatibility.Final Answer:
Video processing service -> Option BQuick Check:
Conversion = Video processing service [OK]
- Confusing upload service with processing
- Thinking CDN does video conversion
- Assuming metadata database handles video files
Solution
Step 1: Understand the logical flow
Users first upload videos, then videos are processed, stored, and metadata is updated last.Step 2: Match the sequence to options
Upload service -> Video processing -> Storage -> Metadata update correctly shows upload first, then processing, storage, and metadata update.Final Answer:
Upload service -> Video processing -> Storage -> Metadata update -> Option DQuick Check:
Upload first, then process, store, update metadata [OK]
- Starting with processing before upload
- Updating metadata before storage
- Mixing storage and upload order
Solution
Step 1: Understand queue behavior when consumer stops
If the processing service crashes, it stops consuming messages, so the queue fills up with unprocessed metadata.Step 2: Impact on user experience
Since processing is delayed, users experience slow video availability or processing delays.Final Answer:
Queue will fill up, causing delays; users see slow processing -> Option CQuick Check:
Processing down -> queue fills -> delays [OK]
- Assuming queue empties without consumer
- Thinking upload service rejects uploads immediately
- Believing metadata DB processes videos automatically
Solution
Step 1: Identify cause of failure handling
Failures without retries mean the system lacks a retry mechanism for failed processing jobs.Step 2: Choose fix to handle failures
Adding retries ensures failed jobs are re-attempted, improving reliability.Final Answer:
Implement a retry mechanism in the processing service for failed jobs -> Option AQuick Check:
Retries fix failed processing [OK]
- Removing queue breaks asynchronous design
- Storing before processing causes errors
- Disabling metadata updates unrelated to retries
Solution
Step 1: Analyze scalability and user wait time needs
Millions of uploads require asynchronous handling and distributed processing to avoid bottlenecks and reduce wait time.Step 2: Evaluate architectural options
Asynchronous upload with queues and distributed workers allows parallel processing and smooth scaling.Final Answer:
Use asynchronous upload service with message queues and distributed processing workers -> Option AQuick Check:
Asynchronous + distributed = scalable and fast [OK]
- Synchronous processing causes delays
- Single server storage limits scalability
- Manual metadata delays pipeline
