Repository navigation
perf(data_plane): x10 rounds: linear IN-list binding, a window's independent views run apart - #909
Merged
Merged
Conversation
…e plan's size Failing test first: a plan with 30 IN-list holes of 2000 placeholders each; binding two of them must take well under the budget (the current binding compares every plan value with every placeholder, ~30 s per bound query at the x10 scale). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lookup The binding compared every value of the serialized plan with every placeholder of the slot (and Utf8 texts again in the leftover check), so a bound query cost plan size x placeholders: with 5000-value IN-list holes in a 3.3 MB x10 plan, ~30 s per bound query (OB_fast_5m, OB_slow_30m, OB_endpoints, OF_q2). The placeholders' JSON texts and Utf8 texts are now hash sets, and only one-level (scalar-shaped) values are looked up: linear in the plan's size. Same rewrite and same errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Failing test: bind() rewrote node by node through bind_json, which prepared the slot (placeholders and values to JSON, their hash sets) for every node: ~2.4 s per bound query on the x10 plan (491 nodes, 5000 placeholders). PreparedSlot is the seam; its stub still prepares per call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… node bind() went through bind_json per node, which converted the slot's placeholders and values to JSON and hashed them again for each of the plan's nodes: ~2.4 s per bound query on the x10 plan (491 nodes, 5000 placeholders). PreparedSlot prepares a slot once; bind() rewrites each node with it, then the plan's other fields (edges, roots) rather than walking the nodes a second time. Binding the x10 plan (copy, rewrite, deserialize) now takes ~110 ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al views Failing test first: every public workload plan (no KLL) stores byte-identical view files whether a refresh group's views that share no node below them run as one run or apart, and some plans run a group in several parts (asap_precompute_window_view_parts above 1). Adds the --precompute-split-views option (EngineOptions::precompute_split_views, default true), not read yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refresh group's views that share no node below them (views over different tables, say) are compiled as separate parts; a window runs its parts at once, one thread each (the first on the precompute thread), so it commits after its slowest part rather than after all of them. The stored rows are the same (byte-identical view files over the public workloads). The parts' CPU counts as the precompute thread's phase CPU. On by default; --precompute-split-views false runs each window whole. The asap_precompute_window_view_parts gauge reports the parts per group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A window's parts other than the first run on threads named precompute-part, so per-thread CPU sampling counts them as precompute; a part thread that cannot start fails the window. 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
intent_full, 74 queries, 840k rows/s, eval build 4), only 8 of 57 10-second rounds ran, and each took 69–80 s. Two causes:OB_fast_5m,OB_slow_30m,OB_endpoints,OF_q2) took ~30 s per query. The binding compared every value of the 3.3 MB serialized plan with each of the slot's 5000 placeholders, and it prepared the slot again for every node.PreparedSlot).--precompute-split-views falserestores the single run.Review guide
eval/2026-12-backend659f1d6 (eval build 4). Three test-first pairs: binding linear (f990c5d → eb33b0d), slot prepared once (bc0ab5b → 29656bf), independent views apart (5e45fc7 → cdf237c, c58ee18).data_plane/src/ingestion.rs, specificallyindependent_view_sets,Precompute::compute(the parts on scoped threads, error and CPU accounting), andcomputed(it now takes(root, rows)). Thendata_plane/src/placeholders.rs(PreparedSlot,Rewrite::is_placeholder).Behavior: before → after
A 56-thread host, suite_v2.c10r10h2
intent_full(build-4 plan), data plane on 48 threads with--precompute-mode window --table-layouts layouts.json --query-parallelism 56 --query-pool-threads 56, one ifeed at 840k rows/s, 10 min of history, 60 rounds at 10 s:--precompute-parallelism 8--precompute-parallelism 16--precompute-parallelism 8--precompute-parallelism 8→ 1.85 s with the views apart (16 parts), at ~9.7 core-s per window either way. The 60 s group goes from ~6.8 s to 2.5 s.--precompute-parallelismadds nothing once the views run apart (xr3-pp8) and costs 17% more precompute CPU, so its default stays 1.Per query, p50/p99 latency in seconds (10 s rounds that ran):
Q| run | binary | 10 s rounds ran | round duration p50/p99 s | data wait p50/p99 s | group latency p50/p99 s | precompute phase core-s | total core-s / M rows |
|---|---|---|---|---|---|---|---|
| b4-1x | eval build 4 | 8/57 | 68.9/79.9 | 9.3/30.0 | 21.1/79.9 | 646 | 6.28 |
| xr1-1x | + hashed binding (eb33b0d) | 20/60 | 21.1/40.4 | 8.7/27.4 | 13.3/38.4 | 693 | 7.52 |
| xr1-pp8 | + slot once (29656bf),
--precompute-parallelism 8| 26/60 | 18.7/38.3 | 6.6/27.4 | 12.0/35.9 | 706 | 8.68 || xr1-pp16 | same,
--precompute-parallelism 16| 25/60 | 19.5/31.7 | 6.7/20.2 | 13.9/28.8 | 723 | 8.80 || xr3-1x | + independent views apart (this PR's defaults) | 30/60 | 15.7/21.3 | 1.9/9.8 | 7.0/19.6 | 793 | 8.42 |
| xr3-pp8 | same,
--precompute-parallelism 8| 29/60 | 16.4/21.5 | 1.7/8.4 | 7.5/19.9 | 930 | 9.33 |--precompute-parallelism 8→ 1.85 s with the views apart (16 parts), at ~9.7 core-s per window either way. The 60 s group goes from ~6.8 s to 2.5 s.--precompute-parallelismadds nothing once the views run apart (xr3-pp8) and costs 17% more precompute CPU, so its default stays 1.Interfaces
data_plane/src/engine.rspub struct EngineOptions { … pub precompute_parallelism: usize, + /// Whether a refresh group's views that share no node below them run + /// as separate runs of a window, at once, each on its own thread + /// (default true): the window commits after its slowest part. The + /// stored rows are the same either way. + pub precompute_split_views: bool, … }data_plane/src/main.rsdata_plane/src/ingestion.rsstruct RefreshGroupRun { views: Vec<MaterializedView>, compiled: CompiledPhysicalDAG, + /// The group's run in independent parts (views sharing no node below + /// them); empty when there is one set. + parts: Vec<CompiledPhysicalDAG>, … } impl Precompute { + /// Runs the independent parts of a group's window at once, one thread + /// each, when `split`; else as one run. Same stored rows either way. + pub fn with_split_views(mut self, split: bool) -> Self; + /// For each refresh group, the runs a window is computed in. + pub fn view_parts(&self) -> Vec<usize>; } +/// `views` (of one refresh group) in sets that share no node below them. +fn independent_view_sets(index: &DagIndex, views: &[PhysicalASAPNodeId], + stop: &HashSet<PhysicalASAPNodeId>) -> Vec<Vec<PhysicalASAPNodeId>>;data_plane/src/placeholders.rsdata_plane/src/metrics.rspub struct WindowLatency { … pub parts: AtomicU64, + /// The independent runs a window computes its views in at once. + pub view_parts: AtomicU64, } +# asap_precompute_window_view_parts{group="…"} (gauge)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(split views on by default). At startupIngestion::newcompiles each refresh group whole and, when its views fall into several independent sets (independent_view_sets), as one part per set. On each closed window,Precompute::computeruns the parts at once: the first on the precompute thread, the others on scopedprecompute-partthreads. It merges their rows by root, then commits them in window order as before. An intent round's dependent query binds its holes withplaceholders::bind, which prepares each slot once (PreparedSlot) and rewrites only the nodes and the plan's other fields. The bound plan is compiled and run as before.Remaining (not in this PR)
These are plan choices, not data-plane issues. The round critical path after this PR:
(host, user)exact counts ([285], shared with SA_top_hosts_1h and SF_q3; predicted 2.8 s) and 10 min ([297], predicted 2.0 s), then regroups byuser. Profile: the executor's group table (GroupTable::column_parts/group_ids, ~30% of query-thread time) inmerge_exact_split.latency, 9 s: OA_p99_5m, OE_p99_now and OF_q1 share one query-time scan plus exact quantile ([0]→[2]; predicted 3.3 + 5.7 s). The planner chose it knowing its latency. OF_q2/OF_q3 come after it, so the OF chain is ~9.5 s.login_fail, because the plan pricessrc IN $SB_Aas if it selected series, while the layout keys series byuser. The planner side is fixed in ASAPPlanner#1570 (series_key_columns). With it, the plan keeps a KMV chain, at ~108 GB of predicted state at x10. Deploying that is an eval decision.Tests
data_planelib: 129 passed.precompute_pool: 7 passed (newindependent_views_of_a_window_run_apart_with_identical_views: byte-identical view files over every public workload plan without KLL, ≥3 plans parted).push_precompute,window_levels,intent_rounds,shared_results: pass.--precompute-split-views false, and the head c58ee18. With--precompute-parallelism 8, 878 are the same. The other 18 are round-1 queries that build 4 fails ("raw samples … are evicted", a timing artifact noted in the build-4 record) and this binary answers. No answered evaluation differs.cargo clippy -p data_planereports two pre-existing errors in files this PR does not touch (metrics.rs:653,table_layout.rs:74).🤖 Generated with Claude Code