Repository navigation
perf(otlp): series cache keyed by metric number and attribute bytes; request bodies in kept buffers - #894
Draft
zzylol wants to merge 3 commits into
Draft
perf(otlp): series cache keyed by metric number and attribute bytes; request bodies in kept buffers#894zzylol wants to merge 3 commits into
zzylol wants to merge 3 commits into
Conversation
…across requests and orders Guards the series cache's key before it changes: the same encoded attributes under the same resource and metric take the same series, built once, whatever the order of metrics and resources; under another metric (one name a prefix of the other) or resource, another series. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
…utes A point's series cache key was the resource's labels, the metric name and the encoded attributes, copied into the key buffer and compared for every point. Each resource's labels and metric name (with its suffix) now get a number once per metric message, and a point's key is that number and its attributes' bytes: less copied and compared per point. Labels are still built only for a series not cached, and every hit is still a byte-for-byte key match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
An OTLP body was collected into a new allocation per request, whose pages faulted in on every request (page faults and the copy were about a tenth of the decode threads' CPU at 100k samples/s). The handler now reads the body frame by frame into a buffer from a small pool (at most 16, none over the 32 MiB a decoder keeps), sized by Content-Length when given, and returns it after decoding. Bodies over the limit still get 413, with the text axum's body extractor answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
zzylol
force-pushed
the
feat/collector-views-file
branch
from
November 30, 2026 07:30
f6a3f5f to
40d0d0d
Compare
zzylol
force-pushed
the
perf/otlp-push-ingest-path
branch
from
November 30, 2026 07:30
258da41 to
0900bea
Compare
This was referenced Nov 30, 2026
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
quantile_over_time(0.99, data[1m])only, DDSketch view, 10k series × 10 samples/s over OTLP/HTTP, push precompute), ASAPQuery-backend spends about 1.40 µs of CPU per sample, end to end. The DDSketch updates are a small part of that.tokio-rt-worker) drop from 0.040 to 0.033 cores; the ingest shards are unchanged. Answers are unchanged.Restack (2026-11-30) onto #891 40d0d0d, at 0900bea
feat/collector-state-lineage, also based on Collector views: control plane rule and collector-views file, data plane --collector-views #891) needs a rebase onto Collector views: control plane rule and collector-views file, data plane --collector-views #891 40d0d0d.Review guide
feat/collector-views-file(Collector views: control plane rule and collector-views file, data plane --collector-views #891). Stack: feat(precompute): close an idle stream's last windows by wall-clock time #889 → feat(precompute): merge late samples into committed windows within retention #892 → Collector view states: ingest OTLP states of the views a collector builds, staged and committed as the view's windows #890 → Collector views: control plane rule and collector-views file, data plane --collector-views #891 → this PR. Stacked draft.crates/adapters/ingest/otlp/src/lib.rs:Walk::metric_id, thenWalk::series(the key).crates/data-plane/src/lib.rs:BodyBufferand its use inwrite_otlp.Cachesonly bundles the decoder's borrowed state forwalk. Movinghttp-body-utilfrom dev-dependencies to dependencies incrates/data-plane/Cargo.tomlis a one-line move.otlp::tests::equal_attributes_are_one_series_per_resource_and_metric: same attributes across requests → same series, built once; another metric (one name a prefix of the other) or another resource → another series. The existinga_decoder_interns_each_series_oncecovers the resource-label cases.Behavior: before → after
The input is a paced feeder sending OTLP/HTTP protobuf, 10k series of
dataat 10 samples/s, 4 requests in flight, todata_plane --plan plan-w2-sps10.json --ingest-threads 2 --precompute-threads 2 --query-threads 2 --no-view-persistence(push precompute). CPU is the data plane's per-thread CPU over 100 s of steady state.tokio-rt-worker)ingest-*)Interfaces
None. Every changed item is private:
otlp::Decoder's fields,Walk, anddata_plane'swrite_otlp/BodyBuffer. A body over the limit still gets 413, and a body that cannot be read gets 400, with the texts axum's body extractor answered with.Algorithm changes
Series lookup per OTLP point.
SeriesCache: predicted next entry, else ahash plus byte compare.Metricmessage, findmetric_id(resource, name, suffix): the same bytes as before up to the attributes, mapped to a number given on first sight.Remaining profile (after, W2 over OTLP,
perf30 s)Over the same 100 s: 1.16 µs/sample in a quiet run (11.7 s CPU for 10.1 M samples). Of that, 74 % is the ingest shards, 22 % the OTLP threads and 3 % jemalloc's background thread. Self time, as a share of all data-plane CPU:
otlp::Walk::metric9.1 % (the protobuf walk, key build and cache probe, inlined).memmove5.8 % (the body copy into the kept buffer and the samples'Vec).memcmp4.1 % (cache key compares).InstalledPrecompute::try_ingest1.5 % (splitting samples by shard).GroupTable::column_parts/ColumnParts::part6.4 %.RawData::append2.8 % and its stable sort 2.0 % (each push morsel is turned into raw data).PushShard::push/fold2.8 % / 2.0 %.summary::executepoll 2.4 %.StateColumnUpdater::update_value2.0 %.DdSketch::try_add2.0 % pluslog1.3 %.Routing::route1.6 %.Valuedrop 1.2 %.This profile was taken with an extra commit, later dropped (see below), that only changed how a shard finds a sample's push groups. The OTLP side is the same code as this PR.
Not done / open
RawDataand sorting it (RawData::append), the executor'sGroupTable/ summary operator, and droppingValues. DDSketchtry_addis about 2 %. Cutting this means feeding push morsels to the summary operator without the generic raw-data → batch → executor path, which is a larger change.Gates
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings: clean.otlp18,storage52,precompute12;data_plane: ingest_protocols, collector_views, server, push_precompute, planner_executor_parity, ingest_shards, window_levels: all pass (with ulimit -n 65536; parity 6/6).🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf