Design a Large File Distribution System
Understanding the Problem
📦 What is a large file distribution system? It's the internal service that copies one big file (a compiled server binary, a container image, an ML model, a search index) from where it was built to every machine that needs it. The file might be gigabytes and the fleet might be tens of thousands of servers across several data centers, and the copy has to finish in minutes because a deploy or an incident fix is waiting on it.
This often comes up as a production engineering question: "you have one 10 GB file and 10,000 servers; how do you get it to all of them as fast as possible?" It's the same problem as distributing software for a rollout, and we'll cover both: the file transfer itself, and how a rollout uses it to switch machines to the new version safely.
Functional Requirements
Core Requirements
- Publishers (a build system, an ML training pipeline) should be able to publish a large file.
- Operators should be able to distribute a file to a set of target hosts, such as "all web servers in production."
- Target hosts should download the file and verify it's complete and uncorrupted before anything uses it.
- Operators should be able to track progress per host, and for software rollouts, activate the new version on hosts in stages once it's downloaded.
Below the line (out of scope)
- Distribution to end users' devices (that's a CDN, see /system-design/cdn) or to mobile apps.
- Building the artifact and deciding what's in a release (that's the CI/CD system).
- Syncing many small files, like a code checkout. We're optimizing for few, very large files.
Non-Functional Requirements
Ask your interviewer for the numbers. We'll design for one 10 GB file, 10,000 target hosts in 5 data centers, each host with a 10 Gbps network card. The links between data centers are shared and far more limited than the network inside each one.
Core Requirements
- The file should reach every healthy host within 5 minutes.
- Each data center's share of the file should cross the expensive inter-data-center (WAN) links only a small number of times, not once per host.
- Every host must end up with a bit-for-bit correct file. A corrupt binary that starts and crashes, or worse, runs, is unacceptable.
- The system should tolerate host failures, slow hosts and network blips without stalling the distribution.
- The transfer should not degrade the production traffic those hosts are serving.
Below the line (out of scope)
- Confidentiality from other internal hosts. We'll assume transfers inside the fleet are authenticated, and encrypt in transit with mTLS, but won't design key management.
Now the math, because it rules out the obvious design.
Total bytes: 10 GB × 10,000 hosts = 100 TB has to be written to disks across the fleet.
From one server: a 10 Gbps NIC moves about 1.25 GB/s. Sending 100 TB through it takes 80,000 seconds, about 22 hours.
From a fleet of file servers: even 50 dedicated servers take 1,600 seconds (about 27 minutes), and if they're all in one data center, 80 TB of that crosses the WAN, which would saturate it and hurt everything else using it.
Using the receivers: the hosts themselves have 10,000 × 10 Gbps = 100 Tbps of combined bandwidth, mostly unused. If every host forwards what it receives, the theoretical floor is close to the time one host needs to download the file once: 10 GB ÷ 1.25 GB/s = 8 seconds, plus overhead. Even at a quarter of line rate, a well-built peer-to-peer system finishes in about a minute.
The insight to state out loud: the bottleneck isn't the file size or the number of hosts, it's the upload bandwidth of the sources. Every host that has part of the file is a potential source, so the system's capacity grows as the transfer progresses. That's why the answer is peer-to-peer.