Skip to content
SD-5 · System design

Design a File Sync and Storage

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

Design a file sync service. People install a client on their laptops and phones, pick a folder, and every file in it is kept the same on all their devices and backed up in the cloud. They can share folders with others, open old versions, and restore deleted files.

There are 700 million accounts, 150 million use it each day, and about 300 million devices are online at peak. Every day brings about 3 billion file changes. The hard parts: a small edit to a large file must not re-send the whole file; hundreds of millions of idle devices must learn about changes within seconds without hammering us; two devices editing the same file must never silently lose work; and the system stores hundreds of petabytes that must never be lost.

Good questions to ask first

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

  1. 1Which clients?
  2. 2How big can a file be?
  3. 3How fast must a change reach other devices?
  4. 4What happens when two devices edit the same file?
  5. 5Do we keep versions?
  6. 6Is sharing in scope?
  7. 7Must devices work offline?
  8. 8Do we need real-time co-editing of documents?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API and sync protocol
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives: blocks, conflicts, notifications
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough