Skip to content
SD-43 · System design

Design a File Downloader

Asked at Senior level45 minutes
Our answers stay hidden until you reveal them.

Design a file download library that apps embed, such as a game launcher, a desktop installer or a dataset tool, together with the backend that serves the files. The app asks the library to fetch a file; the library shows progress, survives a dropped connection, a closed laptop or a reboot, and resumes where it stopped. When it reports done, the file on disk must be exactly the file the publisher released.

The service delivers 50 million downloads a day. Files average 2 GB and reach 100 GB, and on release day 1 million downloads run at the same time, about 25 Tbit/s. The hard part is not the request rate but the bytes and the network: home Wi-Fi and phones drop connections all the time, a restart from zero on a 50 GB file is a lost evening, millions of clients retrying at once can knock over the servers they are retrying against, and a single flipped bit makes a game crash or an installer unsafe.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1What kind of files?
  2. 2How big?
  3. 3How many downloads?
  4. 4Must a download survive the app closing or the device rebooting?
  5. 5Who may download a file?
  6. 6Which platforms?
  7. 7Do we control the client?
  8. 8Do we need delta patches or peer-to-peer?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API and manifest
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Library internals, retries and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough