One 64 MB file lives on a laptop, a phone and in the cloud. The sync app cuts it into 16 blocks. The cloud keeps the blocks in a block store, and the list of blocks for each file in a metadata service. Edit the file, copy it, or edit it on two devices at once, and watch what is sent.
Try it
Speed
Lab time 3.0 s
Laptop — in step — healthy — has version 1
Metadata service — report.bin: version 1 — healthy — 1 file listed
Block store — 16 blocks — healthy — 64 MB
Phone — in step — healthy — has version 1
Ask which blocks the cloud lacks
Send a block, or a new list of blocks
Ask for the newest list
Fetch a block
Sent to the cloud
0 MB
whole files would be 0 MB
Saved: unchanged
0 MB
blocks not sent because they did not change
Saved: already there
0 MB
blocks not sent because the cloud had them
Blocks in the store
16
64 MB for 1 file
Edits that clashed
0
0 kept as a second file
Edits replaced
0
gone, and nobody was told
Numbers add up:0 finished syncs: 0 MB of whole files = 0 MB sent + 0 MB unchanged + 0 MB already in the cloudThe lab checks this sum as it runs, so a counting mistake would show here.
Controls
The file, block by block
Where
State
Version
Times each of the 16 blocks was edited
Laptop
in step
1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Cloud
written by the laptop
1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Phone
in step
1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Two rows with the same numbers hold the same file. A device's version is the cloud version its file was made from.
Files in the cloud
File
Version
Last written by
Size
report.bin
1
Laptop
64 MB
Megabytes sent to the cloud, against sending whole files
Whole filesSent
00.30.50.811s2s3s
Show data table
Time
Whole files
Sent
1s
0
0
1s
0
0
2s
0
0
2s
0
0
3s
0
0
3s
0
0
What just happened
Nothing yet. Start traffic or run an experiment.
What this model simplifies
Every block is 4 MB, and an edit changes one whole block. In a real file, one new line near the start can shift every later block. So some sync and backup tools choose where to cut by looking at the content. This is called content-defined chunking.
Sending one block takes 0.5 s and fetching one takes 0.25 s, one block at a time. Real apps send several at once and squeeze them first.
A fingerprint here is a plain number and takes no time to make. A real one is a hash such as SHA-256, and the app must read every byte of the block to work it out.
The other device is told about each change at once. Real apps keep a connection open to be told, and fall back to asking every few minutes.
A clash is found for the whole file, even when the two edits changed different blocks. Real apps do the same for most files, because joining two edits is safe only for some kinds of file.
Old versions cannot be opened here, though their blocks stay in the store. Real services keep old versions for weeks, which is how a replaced edit can sometimes be found again.