Repository navigation
perf(data_plane): x10 ingest/precompute costs: distinct-value label columns, compact on flush, shared metric Arc; pin ASAPPlanner#1569 - #908
Merged
Conversation
A raw read's label column was a dictionary with one entry per series of the chunk: every read copied each series' label text, and every grouped reader hashed it. Series now carry per-label value ids (assigned at interning), so a label column is a dictionary over the label's distinct values in the chunk (one entry per value), built with no text lookup per series. RawData::append collects each run of one metric and pane before touching the pane map. Answers are unchanged (golden suite_v2 c1 rounds identical). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The windows a coordinator pass closes read the raw data the shards sent with the flush, before that pass's Maintain compacted the panes: a window run read one small chunk per Remote Write request (one label-dictionary entry per row). A shard now compacts the panes its own newest sample puts behind the allowed lateness when it flushes, so the closing windows read one chunk per pane. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e3 + hash equi-join, group table entry cache) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every series held its own Arc of its metric name, so the shard router's 'same metric as the last sample' check (by address) missed on every series change and fell back to comparing texts per sample. Series of one metric now share one Arc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n the worker pool A round waits for the windows ending at its evaluation time to commit; a 10 s window of the x10 suite took ~10-15 s on one precompute thread, so rounds waited ~15 s for data and the next round was missed. A window run now splits its grouped summary builds into --precompute-parallelism parts (default: --query-parallelism) on the query worker pool, like a query run; the executor guarantees the same states for any part count. The pool's CPU is charged to the precompute phase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n it compacts exports_phase_metrics expects one append run per request; the flush-time compaction recorded one per flush even with nothing to compact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured at x10 (840k rows/s): splitting window runs on the pool cut the rounds' data wait from ~15 s to ~12 s but cost +26% precompute CPU (rayon split and idle-steal overhead). Default 1; --precompute-parallelism N opts in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Arc. There is an opt-in--precompute-parallelism. The branch pins ASAPPlannerperf/ingest-x10(ASAPPlanner#1569: hash equi-join, KMV merge, group-table entry cache).Review guide
eval/2026-12-backend19f72f2 (eval build 3). The last pin commit moves the ASAPPlanner rev from 39a25ee3 to the head of ASAPPlanner#1569 (39a25ee3 + 2 executor commits).data_plane/src/store.rs(Chunk::label_column,Chunk::bytes,RawData::append,RawData::seal_through), thendata_plane/src/engine.rs(serve_shard'sFlusharm) anddata_plane/src/ingestion.rs(Routing::flush_seal_through,Precompute::with_parallelism). These need care: the order of rows inside a compacted pane, and the memory accounting of label columns.series_ids.rs(value ids, shared metricArc) is small and mechanical.Behavior: before → after
The intents runner launches the data plane with the suite_v2_noOE.c10r10h2
intent_fullplan, on 48 threads, with--precompute-mode window --table-layouts {"login_fail":{"series_key":["user"]}} --query-parallelism 56 --query-pool-threads 56. One ifeed process feeds it at 840k rows/s (10 minutes of history, then 60 rounds every 10 s). Before/after on the same input and flags:asap_phase_cpu_seconds_total{phase="precompute"}, which also counts its pool CPU). RSS is VmRSS at the first round and at the end of the feed.base2ran with 15 minutes of history, the others with 10 minutes.opt2= the label-column commit alone.r3= + flush compaction + planner join/entry cache.r5= + KMV merge + shared metric +--precompute-parallelismdefaulting to 56.r6= this PR's head (precompute parallelism opt-in, default 1).Interfaces
data_plane/src/engine.rs/// The engine's options (stays; one field added). pub struct EngineOptions { pub ingestion: IngestionOptions, pub max_queued_samples: u64, pub max_precompute_backlog: usize, pub ingest_threads: usize, pub precompute_threads: usize, pub slow_refreshes: Vec<SlowRefresh>, pub check_task_inputs: bool, pub shard_delay_ms: u64, pub persist_threads: usize, pub max_persist_backlog_bytes: u64, pub persist_delay_ms: u64, pub no_forward: bool, pub run_memory_limit_bytes: usize, pub query_threads: usize, pub query_parallelism: usize, + /// Parts each precompute window run's grouped builds split into on the + /// query worker pool (built when `query_parallelism` is above 1); + /// default 1: each window runs on its precompute thread. Above 1 a + /// window commits sooner for more CPU (the pool's split overhead). + pub precompute_parallelism: usize, pub query_pool_threads: usize, pub query_min_split_rows: Option<usize>, pub share_one_evaluation_results: bool, pub label_pushdown: bool, pub table_layouts: crate::table_layout::TableLayouts, pub query_time_results_retention_ms: u64, pub query_time_results_max_bytes: usize, pub result_cache: bool, pub result_cache_max_bytes: usize, pub view_dir: Option<std::path::PathBuf>, pub view_sync_interval_ms: u64, pub view_cache_max_bytes: Option<u64>, pub view_cache_idle_ms: Option<u64>, pub view_segment_ms: i64, pub view_read: ViewRead, pub cold_decode_delay_ms: u64, pub unpersistable_views: Vec<PhysicalASAPNodeId>, pub precompute_mode: PrecomputeMode, pub push_batching: crate::push::MorselBatching, pub precompute_memory_budget_bytes: Option<u64>, pub panic_in_combine_of_window_end_ms: Option<i64>, }data_plane/src/main.rsdata_plane/src/ingestion.rsimpl Routing { + /// Where a shard whose newest sample is at `newest_ms` compacts its + /// panes when it flushes: `newest_ms` minus the allowed lateness. + pub fn flush_seal_through(&self, newest_ms: Option<i64>) -> Option<i64>; } impl Precompute { + /// Splits each window run's grouped builds into `parallelism` parts on + /// the worker pool; the pool's CPU counts as the run's. + pub fn with_parallelism(mut self, parallelism: usize) -> Self; }data_plane/src/series_ids.rsimpl Series { + /// The id of this series' value of the label `name` (an interned name, + /// compared by address); `None` without the label. Equal texts share an id. + pub fn value_id(&self, name: &'static str) -> Option<u32>; }data_plane/src/store.rsimpl RawData { - pub fn seal_through(&mut self, watermark_ms: i64); + /// Compacts each pane ending at or before `watermark_ms`; whether it compacted any. + pub fn seal_through(&mut self, watermark_ms: i64) -> bool; }Usage (end to end):
data_plane --plan plan.json --intent intent_plan.json --precompute-mode window --table-layouts layouts.json --query-parallelism 56 --query-pool-threads 56 [--precompute-parallelism 8]. Remote Write requests go to the shards (RawData::append, one map lookup per run of one metric and pane). On each coordinator pass, every shard compacts the panes behindflush_seal_through(newest)and sends its raw data with the flush. The windows that pass closes runPrecompute::refresh, whoseScans read one chunk per pane; each label column is built over the distinct values (Chunk::label_columnviaSeries::value_id). Each grouped build hashes each value once per batch (ASAPPlanner#1569). The intent round reads the committed views;OU_avg_node_*joins by hash andH_traces_*merges KMV states by sorted union.Algorithm changes
Label columns over distinct values (
Chunk::label_column)StringArray::from_iter_values(series.map(|s| s.get(name)))keyed bycodes→ per series, look upvalue_id(name)(assigned once when the series is interned), map each distinct value id to a dictionary entry, and key each row by its series' entry.a_label_column_has_one_entry_per_distinct_value.O(series)text copies and hashes →O(series)id lookups +O(distinct values)copies +O(rows)key gather. Memory accounting now counts a label column's own keys.Compact on flush (
serve_shard,Routing::flush_seal_through)Maintaincompacted the panes. So a window run read one small chunk per Remote Write request, with about one dictionary entry per row.Flush, a shard compacts the panes that its own newest sample puts behind the allowed lateness, and only then sends its raw data.Maintainwith the same function; this only moves it earlier. A sample that arrives later for a compacted pane adds a chunk, as after any seal. Rows of tables without fields keep their order. Rows of keyed tables are sorted by series and time, asseal_throughalways did, so window runs now see that order. Answers are identical (golden check).appendrun.Shared metric
Arc(series_ids::intern_pairs)Routing::routeandRawData::appendcompare a sample's metric with the previous one by address first. Each series held its ownArc, so that check missed whenever the series changed, and the code fell back to comparing texts per sample. Series of one metric now share oneArc.Opt-in precompute parallelism (
Precompute::with_parallelism)RunContext::with_parallelism: same states for any part count). Measured (r5, enabled by default there): the rounds' data wait fell from ~15 s to ~12 s, but the precompute phase cost +39% CPU (1.23 → 1.71 core-s per M rows), from rayon split and idle-steal overhead. So it defaults to 1.Decisions and open questions
--precompute-parallelism(fewer missed rounds for more CPU). Default here: off.--precompute-mode window --table-layouts {"login_fail":{"series_key":["user"]}}; the intents runner does so now. Without it, login_fail (user × src × target) interns about one series per row: RSS grew 5-10 GB/min (46 GB after 6 minutes) with no plateau. With it, series level off at ~5M.Verification
cargo test --release -p data_plane --no-fail-fastingest_shards::a_shard_running_ahead_does_not_close_windows_earlyfails on the base too (pre-existing since #902, see the eval build record)store::tests::a_label_column_has_one_entry_per_distinct_valueperfLBR flame graphs before and after are in the reportFollow-ups
SE_anomalousis a query-time raw scan ofauthover 1 h (planner gap).OB_fast_5m,OB_endpointsandOF_q2(~30 s) merge all groups before the boundINfilter.placeholders::bindre-serializes and walks the whole plan JSON per bound query (~7% of process CPU during rounds).Reduce), so the push probe rejects them. The "Merge" combine class in docs/design/parallel-precompute.md would move this work onto the 12 ingest shards.🤖 Generated with Claude Code