Skip to content

Measure ASAPv1 serialization and 1,000-source merge cost per sketch - #29

Merged
zzylol merged 2 commits into
mainfrom
feat/merge-bench
Oct 19, 2026
Merged

zzylol merged 2 commits into
mainfrom
feat/merge-bench

Conversation

@zzylol

@zzylol zzylol commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Part 7 of the telemetry-functions stack: experiments 3 (serialization) and 4 (merge at scale). The open questions were whether merging around 1,000 sketches per window is too slow, and whether serialization dominates.

asap-merge-bench times, per sketch type, ASAPv1 encode and decode, and the window_merge path (decode the first payload, then merge_snapshot each of the rest) at 10, 100 and 1,000 sources. Each source sketch holds 20,000 points. --quick runs a CI-sized version. The full results are in docs/results/merge-bench.md.

Results (56-core x86 server, one pinned core, median of 5 runs)

Sketch Bytes per sketch Encode Decode Merge 1,000 from bytes Merge 1,000 already decoded
KLL k=200 2,388 3.5 µs 4.3 µs 9.3 ms 4.7 ms
DDSketch α=0.01 682 4.4 µs 4.2 µs 4.9 ms 0.8 ms
HLL 16,720 8.3 µs 8.3 µs 17.9 ms 10.7 ms
Count-Min 4×2048 8,622 166 µs 65 µs 69.4 ms 6.7 ms
Count-Min + heap 8,767 168 µs 69 µs 80.3 ms 11.9 ms
CountSketch 4×2048 8,706 130 µs 121 µs 124.3 ms 6.8 ms
  • Merging 1,000 sketches is not slow for KLL, DDSketch and HLL: 5–18 ms on one core. The cost grows linearly with the number of sources.
  • For the three counter sketches, decoding ASAPv1 is 86–98% of the merge time. Merging already-decoded Count-Min sketches takes 6.7 ms, against 69 ms from bytes, and encoding is 15–50× slower than for the other sketches. That is the evidence for the design's open question about an Arrow-native or cheaper counter-matrix encoding.

These numbers cover single-threaded encode, decode and merge only, not network transfer. The bench skips the exact baseline's Exact windows (#25), which are not sketches.

cargo fmt --check, cargo clippy --all-targets --features otap-engine,stream-benchmark -- -D warnings and cargo test --features otap-engine,stream-benchmark pass at this PR's head.

@zzylol
zzylol force-pushed the feat/topk-novelty branch from d26cfaf to 671c431 Compare October 13, 2026 00:20
@zzylol
zzylol force-pushed the feat/topk-novelty branch 2 times, most recently from 06893d7 to 35428c5 Compare October 19, 2026 14:57
@zzylol
zzylol force-pushed the feat/merge-bench branch 2 times, most recently from 63b6d95 to a031d61 Compare October 19, 2026 17:33
@zzylol
zzylol force-pushed the feat/topk-novelty branch from 35428c5 to ba10dd1 Compare October 19, 2026 17:33
@zzylol
zzylol force-pushed the feat/topk-novelty branch 2 times, most recently from 36e394c to fdc16b4 Compare October 19, 2026 20:16
@zzylol
zzylol force-pushed the feat/merge-bench branch 2 times, most recently from 1576e2d to c261c17 Compare October 19, 2026 20:16
@zzylol
zzylol force-pushed the feat/topk-novelty branch 2 times, most recently from 267f76d to d840ecd Compare October 19, 2026 20:16
@zzylol
zzylol force-pushed the feat/topk-novelty branch from d840ecd to 39729c5 Compare October 19, 2026 20:17
@zzylol
zzylol force-pushed the feat/topk-novelty branch from 39729c5 to ad9b849 Compare October 19, 2026 20:17
@zzylol
zzylol force-pushed the feat/merge-bench branch 2 times, most recently from 9cf249a to 5e8ff88 Compare October 19, 2026 20:18
@zzylol
zzylol force-pushed the feat/topk-novelty branch from ad9b849 to 4e854e6 Compare October 19, 2026 20:18
@zzylol
zzylol changed the base branch from feat/topk-novelty to main October 19, 2026 20:18
@zzylol
zzylol merged commit fb93e8d into main Oct 19, 2026
@zzylol
zzylol deleted the feat/merge-bench branch October 19, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant