Closed
v3: CDC (content-defined chunking) chunk dedup for blob data#2032
Conversation
Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
…warn Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
imeoer
August 14, 2026 06:14
View session
Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
…expectations in e2e Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
Co-authored-by: imeoer <1524576+imeoer@users.noreply.github.com>
Collaborator
|
dup with #2041 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixed-size chunking dedups poorly: a small insertion shifts every later byte, so near-identical content (e.g. two versions of the
nodebinary) shares almost nothing. This adds opt-in content-defined chunking so duplicate data is stored once regardless of offset, within and across files/layers — with no changes to the EROFS-visible format.Measured benefits (rootfs bytes, CDC 4K/16K/64K vs fixed chunking)
Inter-image (node:22.14.0–22.17.0-slim):
nodebinary across versions: fixed-4K 2.0% (offset shift) vs CDC 24–26%Intra-image (cross-layer):
These are lower bounds from clean upstream images; business images (frequent small updates, vendored duplicates) should dedup higher.
Design
Two address spaces, CDC entirely below the EROFS layer:
logical_block_countheader field × 4 KiB.The chunk table stores 56-byte records
(digest, logical_byte_offset, unique_byte_offset, size), sorted by logical offset; uncovered logical ranges read as zeros. Runtime: binary-search records overlapping a read → map each cold record's unique range to group(s) via the existing>> group_block_bitsdivision → decode (memoized, single-flight, cross-process locked) → copy to the logical offset in the cache file. Readiness is per record in a.chunk.mapsidecar.Changes
BlobMetadataCdcChunkrecord,CHUNK_CDCincompat flag,logical_block_countheader field (bytes 56..64, zero for non-CDC → non-CDC output stays byte-identical), validation, mmap access, CRC/serialization branches.BlobWriter::with_cdc()— FastCDC split + blake3 dedup map + byte-granular unique-stream append (tail group block-padded at finish);--cdcCLI flag;cdc_dedupstats in build output;fastcdc = "3"dep.LocalBlobCache— logical-sized cache file, per-record readiness map,ensure_byte_rangefills records in unique-offset order with a group-decode memo,prefetch_alldecodes each group ~once,ready_rangescounts logical gaps as ready zeros.Unsupported) — its group re-slicing assumes logical == group space.NydusCore.--cdcoption and CDC blob meta layout indocs/nydus.md.Future work
nydus optimize