AlgoViz

File chunking and deduplication

medium 4 min

Fixed-size chunks make offsets predictable.

Video lesson · Chapter 1 of 5

Two backups share their edges

0:00 / 3:51

One inserted byte changes a whole backup

1:13Reel

Theory

Read or listen first. About 1 min.

What it is

A backup can reuse stored chunks when their bytes match. The choice of cut points determines whether an insertion spoils just one match or shifts many later chunks.

Insert one byte at the start of a backup

Original bytesABCDEFGHAfter inserting XXABCDEFGHAll chunk boundaries move relative to the old bytes.
The original eight bytes split into AB, CD, EF and GH. Prepending X shifts every two-byte cut, so none of the old chunks can be reused here.

Why it exists

Content-sensitive cuts can line up again within unchanged data. That lets a small edit transfer a few new chunks while later chunks still refer to the earlier backup.

Words to know

Chunk fingerprint
A digest used to identify a chunk by its contents for comparison or reuse.

How it works

Step through the idea, or press Play.

Step 1 of 3

Cut the original. Fixed offsets divide the file into equal pieces.

Understand it

Worked example

File chunking and deduplication in practice

Insert a small header before a large file. Fixed offsets shift every subsequent block boundary. With content-defined cuts, later unchanged bytes may produce the same chunk hashes after the next stable boundary.

Related case

One lecture, many connection speeds

A student switches from Wi-Fi to cellular halfway through a lecture. The player needs a smaller rendition without losing its place. The backup service also needs to deduplicate edited uploads.

Four seconds before a stall
A four-second segment on a slow linkPlayer4 s buffered4 Mbps rendition4 seconds of videoStart with a full four-second buffer

A player can decode the next span at a lower quality.

Sources