feat: benchmark delta transmission — accuracy, payload size, CPU/memory (#66) - #69
Merged
zzylol merged 5 commits intoMar 22, 2026
Conversation
…script Adds an in-process accuracy+payload-size benchmark (cmd/deltaaccbench) and an e2e orchestration script (bench_delta.sh) that covers all sketch types and aggregation modes with delta transmission on/off. - cmd/deltaaccbench/main.go: self-contained Go benchmark; simulates N streaming windows per sketch, emits full or sparse-delta payloads, reconstructs at receiver, and reports avg_full_bytes, avg_delta_bytes, compression_ratio, avg_mean_rel_err, max_rel_err, correct_recon, CPU/memory usage - go.mod/go.sum: upgrade sketchlib-go to v0.0.0-20260321024028 (delta APIs); promote xxhash to direct dependency - 8 new delta-enabled collector configs for CMS, CS, HLL, DDSketch (batch+window modes for each) - otel_collector_benchmark/bench_delta.sh: e2e script iterating all 3 modes × all sketch types × delta on/off × rates; measures bandwidth, collector CPU/memory via ps sampling Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fallback - Point sketchlib-go to local repo (../../sketchlib-go) which carries the new incremental-sketch delta implementation for DDSketch - Add size-based fallback in benchDD: transmit full when delta >= full to prevent size regressions on high-entropy batch windows - Fix CS rows: use failure probability (0.01) not confidence (0.99) so rows = ceil(log(100)) = 5 instead of 1, giving correct theoretical guarantees - Fix CMS cols: 2048 (power-of-2 matching config ~2000) instead of 512 - Fix window-mode accuracy: use cumulative frequencies as ground truth for CMS and CS in window mode, not just the latest window's frequencies - Add --min-freq flag (default 10): skip rare keys in CMS/CS error measurement (CMS is a heavy-hitter estimator; rare keys dominate mean relative error due to the additive ε·N error bound) Results after optimization: DD window+delta: 1.20x compression, correct_recon=true, accuracy unchanged DD batch+delta: 1.09x compression via size-based fallback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pact DDSketch SerializeToBytes stores only the contiguous occupied bucket range; empty-bucket overhead is already zero in batch mode. Delta transmission brings no benefit and was incorrectly benchmarked as a separate config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ComputeDelta for CMS/CS now returns (*Delta, error) — callers must call SerializeDelta to get []byte. HLL ComputeRegisterDelta returns *RegisterDelta (no error) — callers must call SerializeRegisterDelta. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
zzylol
deleted the
66-benchmark-delta-transmission-with-accuracy-bandwidth-memory-cpu-usage
branch
March 22, 2026 20:02
SieDeta
pushed a commit
that referenced
this pull request
Apr 17, 2026
…ry (#66) (#69) * feat: add delta-transmission benchmark (deltaaccbench) and e2e bench script Adds an in-process accuracy+payload-size benchmark (cmd/deltaaccbench) and an e2e orchestration script (bench_delta.sh) that covers all sketch types and aggregation modes with delta transmission on/off. - cmd/deltaaccbench/main.go: self-contained Go benchmark; simulates N streaming windows per sketch, emits full or sparse-delta payloads, reconstructs at receiver, and reports avg_full_bytes, avg_delta_bytes, compression_ratio, avg_mean_rel_err, max_rel_err, correct_recon, CPU/memory usage - go.mod/go.sum: upgrade sketchlib-go to v0.0.0-20260321024028 (delta APIs); promote xxhash to direct dependency - 8 new delta-enabled collector configs for CMS, CS, HLL, DDSketch (batch+window modes for each) - otel_collector_benchmark/bench_delta.sh: e2e script iterating all 3 modes × all sketch types × delta on/off × rates; measures bandwidth, collector CPU/memory via ps sampling Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(deltaaccbench): optimize DDSketch delta — gob codec + size-based fallback - Point sketchlib-go to local repo (../../sketchlib-go) which carries the new incremental-sketch delta implementation for DDSketch - Add size-based fallback in benchDD: transmit full when delta >= full to prevent size regressions on high-entropy batch windows - Fix CS rows: use failure probability (0.01) not confidence (0.99) so rows = ceil(log(100)) = 5 instead of 1, giving correct theoretical guarantees - Fix CMS cols: 2048 (power-of-2 matching config ~2000) instead of 512 - Fix window-mode accuracy: use cumulative frequencies as ground truth for CMS and CS in window mode, not just the latest window's frequencies - Add --min-freq flag (default 10): skip rare keys in CMS/CS error measurement (CMS is a heavy-hitter estimator; rare keys dominate mean relative error due to the additive ε·N error bound) Results after optimization: DD window+delta: 1.20x compression, correct_recon=true, accuracy unchanged DD batch+delta: 1.09x compression via size-based fallback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(deltaaccbench): skip DD delta in batch mode — full is already compact DDSketch SerializeToBytes stores only the contiguous occupied bucket range; empty-bucket overhead is already zero in batch mode. Delta transmission brings no benefit and was incorrectly benchmarked as a separate config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: update SDK aggregators to use split delta API (algo+codec) ComputeDelta for CMS/CS now returns (*Delta, error) — callers must call SerializeDelta to get []byte. HLL ComputeRegisterDelta returns *RegisterDelta (no error) — callers must call SerializeRegisterDelta. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: finish delta benchmark config matrix --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Jul 8, 2026
4 tasks
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.
Summary
opentelemetry-app/cmd/deltaaccbench/— self-contained Go benchmark that runs entirely in-process. Simulates N streaming windows per sketch, sends full or sparse-delta payloads, reconstructs at the receiver, and reports compression, accuracy, and resource usage.otel_collector_benchmark/bench_delta.sh— e2e orchestration script measuring bandwidth, collector CPU/memory.sketchlib-go— replaces the broken protobuf codec with an incremental-sketch approach (gob +Merge) plus a size-based fallback.Benchmark results
Parameters: 20 windows × 5000 inserts/window, Zipf(s=1.1, v=1.0, max=5000), delta threshold=1.
CMS/CS accuracy on keys with true frequency >= 10 (heavy-hitter range).
Key findings
CountSketch wins on delta compression
5.6-7.5x compression with zero accuracy impact. Window mode (7.49x) beats batch (5.60x) because the cumulative sketch is dense but each window adds sparse increments.
HLL window+delta halves payload size
1.94x compression, lossless (0.73% accuracy unchanged). Not applicable in batch mode.
CMS: modest compression, accurate in batch
1.4-1.6x compression, zero accuracy impact in batch (0.16%). Window mode error (4.7%) is an inherent CMS property — as accumulated N grows, the eps*N error bound grows — unrelated to delta.
DDSketch delta: window-only, fixed from broken (0.5x) to working (1.20x)
DDSketch batch mode does not use delta.
SerializeToBytesstores a denseuint64array spanning only the occupied bucket range — empty buckets at the edges are never stored. Each batch window produces an independent sketch from scratch, so the full payload is already maximally compact. Delta would only add overhead.Root cause of the original failure (window mode): DDSketch full serialization uses gob on a dense
uint64array (~1.7 B/entry). The old protobuf delta format cost ~11 B/entry, making every delta larger than the full.Fix — incremental-sketch approach:
ComputeDeltabuilds a new DDSketch containing onlycur[k] - snap[k]for each grown bucket, serialized withSerializeToBytes(same gob codec). Per-window increment counts are small integers → shorter gob varints.ApplyDeltacallstarget.Merge(incr)— no per-bucket fixups needed.len(delta) >= len(full).Results: window mode 1.20x compression, correct_recon=true, accuracy unchanged (0.29%).
Changes to
sketchlib-go(optimize-dd-deltabranch):DDSketch/delta.go— incremental-sketch approach, removes protobuf dependencySubtractFromBuckettoDDSketch.goKLL: no delta support, accurate full-sketch baseline (0.23-0.30%)
correct_reconsummaryE2E
bench_delta.shresultsParameters: 60s per scenario, 1000 series, rates 10k and 50k MPS, modes
sdkSketch/colBatch/colWindow.Notes:
HLLbinary that did not include the newdelta_transmissionconfig field. After rebuildingHLL, I reran the full HLL slice and used those rerun rows for the final HLL numbers below.Selected 50k MPS live results
E2E takeaways
colBatchat 50k MPS, collector memory drops from 776.76 MB to 46.25 MB with delta enabled; at 10k MPS it drops from 181.17 MB to 38.92 MB.colWindowafter rebuilding the live binary. At 50k MPS, collector memory falls from 303.00 MB to 209.70 MB; at 10k MPS, from 285.48 MB to 187.98 MB.colBatchat 50k. Average loopback bandwidth drops from 2190.52 KB/s to 1502.24 KB/s, while collector memory stays roughly flat around 200 MB.colWindow, but the collector remains heavy. At 50k MPS, collector memory drops from 3342.99 MB to 2211.78 MB;colBatchremains >2 GB either way.colBatchat 50k MPS with 1567.76 MB collector memory.Test plan
go build ./cmd/deltaaccbenchcompiles cleanly--sketch=all --windows=3 --inserts=300passesHLLand reran--sketch hll --mode allso delta-enabled HLL rows are included in the e2e resultsbench_delta.sh --sketch all --mode all --duration 60scompleted locally against live collector binariesGenerated with Claude Code