X6 Rule: Content-Defined Chunking Threshold and Chunk Sizes
ADR 0003 section 6.4 row X6, for step G2 (issue #45). This file fixes the candidates, the corpus, the measurements, the deduplication rule, and the decision criterion BEFORE any X6 run. It is committed on its own; the runs, the raw samples, and the outcome are added in later commits and must not change anything below.
1. The Chunker (fixed for every candidate)
A FastCDC-style gear chunker [S20] with normalized chunking, written in synapse-store:
- Gear table.
G[i],i = 0..255, is thei-th output (first output isG[0]) of SplitMix64 seeded with0x5359_4E41_5053_4531(ASCIISYNAPSE1): `state += 0x9E37_79B9_7F4A_7C15; z = state; z = (z ^ (z >> 30)) * 0xBF58_476D_1CE4_E5B9; z = (z ^ (z >> 27)) * 0x94D0_49BB_1331_11EB; out = z ^ (z >> 31)(wrapping arithmetic onu64`). - Rolling hash.
h = (h << 1) + G[byte](wrapping), reset to 0 at the start of every chunk. - Cut rule for the remaining bytes
srcof a blob, withbits = log2(avg),mask_s= the topbits + 2bits of au64set,mask_l= the topbits - 2bits set: iflen(src) <= minthe rest is one chunk; otherwisen = min(len(src), max), hashing starts at bytemin(bytes before it are skipped), the cut is after byteiat the firstiwithh & mask_s == 0whilei < min(avg, n), else the firstiwithh & mask_l == 0whilei < n, else atn. - Threshold. A blob of
len <= Tbytes is stored whole (one copy perBlobDigest, as before G2). A blob oflen > Tbytes is cut into chunks; each chunk is stored once perChunkDigest. - Chunk identity.
ChunkDigest = SHA-256("SYNAPSE_CHUNK_V1\0" || u64 LE length || bytes). A blob's identity stays itsBlobDigestover the whole content (CONTEXT.md).
2. Candidates
min = avg / 4, max = 4 * avg for every chunked candidate.
| Id | Threshold T | min | avg | max |
|---|---|---|---|---|
| C0 | no chunking (control: every blob whole, the A2 behaviour) | |||
| K1 | 16 KiB | 1 KiB | 4 KiB | 16 KiB |
| K2 | 16 KiB | 2 KiB | 8 KiB | 32 KiB |
| K3 | 64 KiB | 2 KiB | 8 KiB | 32 KiB |
| K4 | 64 KiB | 4 KiB | 16 KiB | 64 KiB |
| K5 | 64 KiB | 8 KiB | 32 KiB | 128 KiB |
| K6 | 256 KiB | 4 KiB | 16 KiB | 64 KiB |
| K7 | 256 KiB | 16 KiB | 64 KiB | 256 KiB |
3. Corpus: Real AIEN Repository Histories
Bare clones of four AIEN repositories at these commits (fetched 2026-10-16):
| Repository | Commit |
|---|---|
aien-spark/aien-architecture | d2768e9b8730af5f13c0fbbdfbfa4ba788f7605a |
aien-spark/aienos | b7ebf7cde234e1ddcc91eb8fcaf378d060cfb3a2 |
aien-spark/omega | 43d8d20da2f64319bcf6196ac7204021c3f280eb |
aien-spark/synapse | b9f46b16aa74301f0b330cfb5fa2e06f07d60b43 |
- History:
git log --reverse --first-parent --raw --no-renamesof each commit, repositories in the order of the table. Survey before the runs (fromgit cat-file --batch-check, not a run): 24,093 added or modified regular-file revisions, 434 MB of content, 4,676 revisions above 16 KiB. - One accepted change per commit that adds or modifies at least one regular file (mode
100644or100755): one signed changeset with oneUpsertper such file. Deletions, symlinks, and submodules store no content and are left out. Paths are replaced by a stable synthetic path per repository path (p<n>), since paths do not affect storage. - The client provides a blob's bytes only the first time its
BlobDigestappears in the run (as a client that asks which blobs the server lacks would); later references name the committed blob. - Store limits for the run:
max_paths_per_changesetandmax_total_changeset_bytesraised so that no commit is refused (the largest commit decides; the value is recorded in the raw output); every other limit at its default; group commit (GROUP_COMMIT_DEFAULT), one agent, strict recovery.
4. Measurements
Per candidate and repetition, on a fresh store on the same ext4/NVMe filesystem as the A2 runs:
- Ingest phase: submit every change in order, one agent; record each change's time from submit
to durable acknowledgement (raw samples) and the phase wall time. Energy: one
aien_spbmpackage window around the phase (INSTRUMENT_UNAVAILABLEwhen the meter refuses, never a substitute). - Log bytes: bytes the store appended to its segments during the ingest phase (4 KiB-padded batches, so frame headers, metadata, chunk tables, manifests, and padding all count), and the content bytes stored (whole blobs plus distinct chunks). Both are deterministic for a sequential run; if repetitions of one candidate disagree, the run is invalid.
- Read phase: read every distinct committed blob once, in commit order, through
get_blob_visible; each read is compared byte for byte with the corpus bytes (any difference makes the run invalid); record each read's time (raw samples), the phase wall time, and one energy window.
Three repetitions; inside each repetition all eight configurations run once, in an order rotated by
one position per repetition. Bounds (ADR section 6.2): seconds per accepted change against the A2 flush
bound (1.006 ms, evidence/a2-segment-store/measurement/floor.json, cheapest
overwrite_*_fdatasync p50); a read of n bytes against n / 273 GB/s plus one index lookup.
5. Deduplication Rule (the G2 acceptance)
For a store with chunk parameters (T, min, avg, max):
- A blob of
len <= Tis stored whole and is never cut. - A blob of
len > Tis cut by the chunker of section 1; reading it returns exactly its bytes, and itsBlobDigestis unchanged. - The store keeps one copy of every
ChunkDigestit indexes. Committing a revisionBof a blob aboveTafter a committed revisionAwhose chunks are still indexed stores exactly the distinct chunks ofBwhoseChunkDigestis not already indexed (chunks committed earlier in the same batch count as indexed): content bytes added = the sum of their lengths, nothing for the shared chunks. A revision whoseBlobDigestis already stored adds no chunk.
6. Decision Criterion
Let, for configuration k: W_k = median over the three repetitions of (ingest phase wall time /
accepted changes); R_k = median of (read phase wall time / reads); S_k = log bytes of the ingest
phase.
- A chunked candidate is eligible when all three hold:
W_k <= 1.10 * W_C0(seconds per accepted change at most 10 % above the control),R_k <= 1.25 * R_C0(seconds per read at most 25 % above), andS_k <= 0.95 * S_C0(at least 5 % fewer log bytes). - The winner is the eligible candidate with the smallest
S_k. Candidates within 1 % of that smallestS_kare ties; among ties the largeravgwins, then the largerT(fewer chunks to index and fewer reads). - If no candidate is eligible, G2 ships the chunk store with chunking off by default
(
T= unlimited) and reports that outcome; the round-trip and deduplication tests still run with explicit parameters. - Joules per accepted change and per read are measured and reported for every configuration but do not enter the decision: on this shared host the A2 package energy above idle was inside the noise (some A2 cells read below idle), so a joule criterion would decide on noise.
Sources
- [S20] Xia et al., "FastCDC", USENIX ATC 2016 (ADR 0003 section 12).