Scalable Video Moderation System Design
Data Flow Basics
Why One Computer Isn't Enough
A platform like TikTok handles over 100 million video uploads every day. A single computer, no matter how powerful, would buckle under that load. It would be like one person trying to cook for an entire city. It’s just not possible.
To solve this, large tech companies use what’s called a distributed system a team of many computers, called nodes, working together. Instead of relying on one super-strong machine, they use a network of hundreds or thousands of standard computers.
Think of it like this. You can either hire one world-class weightlifter to move your entire house (which is impossible), or you can hire a team of 20 regular movers. The team approach is not only more effective, but it’s also more flexible. This is the core idea behind scaling a system.
| Scaling Type | Analogy | Description |
|---|---|---|
| Vertical Scaling | The Weightlifter | Making a single computer more powerful by adding more memory or a faster processor. It's expensive and has a hard limit. |
| Horizontal Scaling | The Moving Team | Adding more computers (nodes) to the system. It's cheaper, more flexible, and can handle massive growth. |
For a global video platform, is the only option. It allows the system to grow by simply adding more nodes to the team, ensuring it can handle a near-infinite number of videos and users.
The Journey of a Video
So how does a video get from your phone into this massive system? It follows a path called an ingestion pipeline. We can imagine it like a busy restaurant.
You, the user, are the customer. Your video is your order. You don’t just walk into the kitchen and shout your order to the chefs. You hand it to a waiter.
In our system, this waiter is an API Gateway. It's the front door for all incoming requests. It validates your order, makes sure you're a legitimate customer, and then passes it along to the kitchen.
The API Gateway places the video into a task queue, which is like the ticket rail in a kitchen where chefs pick up new orders. This queue holds all the jobs that need to be done.
From the queue, different specialized services, called , pick up the task. One service might compress the video to save space, another might generate a thumbnail, and a third might scan it for harmful content. Each service is like a chef with a specific job. This teamwork ensures that even if one chef is busy or an oven breaks, the restaurant keeps running smoothly.
Sending a Video in Pieces
Uploading a large video file in one go is risky. If your internet connection drops for just a second, the entire upload fails, and you have to start over from the beginning. It's frustrating and wastes a lot of data.
To prevent this, platforms use a technique called chunking. The application on your phone slices the large video file into many small, numbered pieces, or "chunks." It then uploads these chunks one by one.
This way, if an upload for one chunk fails, the system only needs to re-send that single small piece, not the entire gigabyte-sized file. This is known as a resumable upload.
It’s like sending a large book through the mail. Instead of shipping the whole 500-page volume in one box, you send it one chapter at a time. If Chapter 5 gets lost, you only need to resend those few pages, not the whole book. Once all the chunks arrive at the destination, the system reassembles them in the correct order to recreate the original video file.
Because raw video files can range from a few megabytes to multiple gigabytes, simply hosting video content is not enough to ensure a smooth viewer experience - video streaming technologies such as adaptive bitrate delivery, content delivery networks (CDNs), and efficient encoding are essential for fast load times and uninterrupted playback across devices.
This process makes uploads much faster and far more reliable, especially on unstable mobile networks.
What is the primary reason large tech platforms use a distributed system?
When a platform grows by adding more standard computers to its network, it is using a strategy called __________.
Now that we've covered the basics of how data flows into a large-scale system, you can see the clever engineering required to make something as simple as uploading a video work for millions of people at once.