SD-5 · Back to the write-up
Design a File Sync and Storage
Upload only the blocks the server lacks, commit with a version check into a per-folder journal, and push a short notice so other devices fetch from their cursor.
Follow a request
Save an edit
Another device catches up
Two edits collide
A commit times out
Clean up old versions
Devices
Edge
Services
Data
Sync clientLaptop or phone
NotificationWebSockets
Load balancerAPI calls
Metadata serversCommits, changes
Block serversBytes
Change busns events
Cleanup jobsVersions, blocks
Metadata DB32 shards by ns
Block indexhash → location
Block storageErasure coded
The numbers, at a glance
100 KB of new blocks2 MB whole file
82 PBY1
164 PBY2
246 PBY3
328 PBY4
410 PBY5
1% find a change99% say nothing new
An edit reaches another device
Blocks first, commit second, notice third. The notice carries no data.
Laptop
Block server
Metadata server
Metadata DB
Notification
Desktop
1 PUT missing block
2 201
3 commit, parent rev 41
4 append if rev = 41
5 seq 9,812
6 200 rev 9,812
7 ns 77 changed
8 changed: ns 77
9 changes after cursor
10 22 entries
11 GET block h7
12 4 MB
RequestResponseAsync, does not block
What travels when a file changes
The decision that sets every byte rate in this design.
edit 1 slide
PUT 100 MB
100 MB to each device
+ Simple.− 200 GB/s at peak; a full copy per version.
hash 25 blocks
check → 1 missing
PUT 4 MB, commit list
+ Only new blocks travel; dedup for free.− Insertions shift later blocks.
rolling hash
cut at content marks
PUT changed chunks
+ Insertions stay local.− Variable sizes, more CPU.
How it grows
Add a box only when a number forces you to. Highlighted boxes are new at each stage.
Sync client
App server
DatabaseObject storage
Sync client
Load balancer
Metadata serversBlock servers
Journal DBBlock indexBlock storage
Sync client
Notification serversLoad balancer
Metadata serversChange busBlock servers
Journal DBBlock indexBlock storage
Sync client
Notification serversLoad balancer
Metadata serversChange busBlock serversCleanup jobs
32 journal shardsBlock indexBlock storage
Was this walkthrough useful?Your vote tells us what to improve next.