interplane.Get Omega
Read in your language

synapse

A component of the AienOS ecosystem.

Brought by drakestapleton

branch main Branches Tags History

synapse / evidence / g2-content-defined-chunking / x6 / RULE.md

121 lines · 7469 bytes Raw Blame History Source

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:

2. Candidates

min = avg / 4, max = 4 * avg for every chunked candidate.

IdThreshold Tminavgmax
C0no chunking (control: every blob whole, the A2 behaviour)
K116 KiB1 KiB4 KiB16 KiB
K216 KiB2 KiB8 KiB32 KiB
K364 KiB2 KiB8 KiB32 KiB
K464 KiB4 KiB16 KiB64 KiB
K564 KiB8 KiB32 KiB128 KiB
K6256 KiB4 KiB16 KiB64 KiB
K7256 KiB16 KiB64 KiB256 KiB

3. Corpus: Real AIEN Repository Histories

Bare clones of four AIEN repositories at these commits (fetched 2026-10-16):

RepositoryCommit
aien-spark/aien-architectured2768e9b8730af5f13c0fbbdfbfa4ba788f7605a
aien-spark/aienosb7ebf7cde234e1ddcc91eb8fcaf378d060cfb3a2
aien-spark/omega43d8d20da2f64319bcf6196ac7204021c3f280eb
aien-spark/synapseb9f46b16aa74301f0b330cfb5fa2e06f07d60b43

4. Measurements

Per candidate and repetition, on a fresh store on the same ext4/NVMe filesystem as the A2 runs:

  1. 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_spbm package window around the phase (INSTRUMENT_UNAVAILABLE when the meter refuses, never a substitute).
  2. 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.
  3. 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):

  1. A blob of len <= T is stored whole and is never cut.
  2. A blob of len > T is cut by the chunker of section 1; reading it returns exactly its bytes, and its BlobDigest is unchanged.
  3. The store keeps one copy of every ChunkDigest it indexes. Committing a revision B of a blob above T after a committed revision A whose chunks are still indexed stores exactly the distinct chunks of B whose ChunkDigest is 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 whose BlobDigest is 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.

  1. 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), and S_k <= 0.95 * S_C0 (at least 5 % fewer log bytes).
  2. The winner is the eligible candidate with the smallest S_k. Candidates within 1 % of that smallest S_k are ties; among ties the larger avg wins, then the larger T (fewer chunks to index and fewer reads).
  3. 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.
  4. 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