Repository navigation
Conversation
…runs answer like one thread (failing) EngineOptions::query_parallelism and the asap_query_parallel_tasks_total counter are stubs (unused, never incremented). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi
…ies per round - --query-parallelism N (EngineOptions::query_parallelism, default the cores) sizes rayon's global pool; each query run splits its grouped builds and merges by group key into N parts (executor RunContext::with_parallelism) and raw reads convert the ingest shards in parallel, keeping their order. Answers are identical for any N. asap_query_parallel_tasks_total counts the partition tasks. - IntentLoop::run_round schedules by dataflow: a query starts as soon as every upstream it reads has finished; independent queries run at once on the query workers. Statuses, bindings, timeouts, group latency and record order are unchanged. - Pins ASAPPlanner feat/parallel-query-exec (stacked on #1553). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi
zzylol
added a commit
that referenced
this pull request
Dec 4, 2026
… query pool size
Review findings on parallel query runs:
- The partition tasks' worker CPU (executor RunContext::parallel_cpu_ns)
and the parallel shard reads' worker CPU are charged to the query
worker thread (metrics::add_offloaded_cpu_ns), which Timer and
PhaseStats::record include: asap_phase_cpu_seconds_total{phase=query}
counts the work wherever it ran; asap_query_parallel_cpu_seconds_total
reports the worker share.
- --query-pool-threads sizes the worker pool apart from
--query-parallelism (parts per run); a failed build_global is logged
and asap_query_pool_threads reports the pool's size. Ingest, precompute
and persist threads share the cores.
- query_min_split_rows (tests) lets small tables split.
- Pins ASAPPlanner feat/parallel-query-exec 74621ba2 (split merges by
wave, small inputs on one thread, worker CPU per run).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi
zzylol
force-pushed
the
feat/parallel-rounds
branch
from
December 4, 2026 04:02
ae4888c to
4467d93
Compare
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
--query-parallelism N(default: the cores) does three things. It sizes rayon's global pool. It makes each query run split its grouped builds and merges by group key into N parts (the planner executor'sRunContext::with_parallelism). And it makes raw reads convert the ingest shards in parallel, keeping their order. Separately, the intent round loop now starts a query as soon as its upstreams finish, so independent queries run at once.Review fixes (second round)
RunContext::parallel_cpu_ns) and the parallel shard reads' worker CPU are charged to the query worker thread (metrics::add_offloaded_cpu_ns).TimerandPhaseStats::recordinclude that charge, soasap_phase_cpu_seconds_total{phase="query"}counts the work wherever it ran. The worker share is also reported separately asasap_query_parallel_cpu_seconds_total. Tests:metrics::tests::worker_cpu_charged_to_the_thread_counts_in_its_phase, and the e2e test now asserts that query-phase CPU ≥ worker CPU > 0 at parallelism 4.--query-pool-threadssets the rayon pool size;--query-parallelismsets the parts per run. Both default to the cores. Ingest, precompute and persist threads share the same cores.build_globalis now logged as a warning, and the actual pool size is reported as the gaugeasap_query_pool_threads.Review guide
feat/raw-read-label-pushdown). Pins ASAPPlannerfeat/parallel-query-exec= feat(executor): split grouped summary builds and merges by group key over worker threads ASAPPlanner#1563 (head 74621ba2, stacked on feat(sil): plan SIL intents: parse/check, lowering, hole guard, planning modes, group latency (L_G) ASAPPlanner#1553).intent.rsIntentLoop::run_round(dataflow scheduling),query.rsQueryEngine::run_compiled/with_parallelism,store.rsRunStore::read_raw_data.EngineOptionsfield, the metric, and the pin bump.Behavior: before → after
data_plane --plan n1.json --intent ... --query-parallelism 16:query-part-*threads, and the shards' raw chunks are converted in parallel. q1, q2 and q3 return the same rows and bindings.With N5 (18 independent queries per clock), each round's queries now run concurrently on the query workers.
Interfaces
data_plane/src/engine.rs,main.rs,query.rs,store.rs,metrics.rspub struct EngineOptions { + /// Parts one query run splits each grouped build and merge into (by group key); also turns on parallel shard reads; default the cores; answers identical for any value. + pub query_parallelism: usize, + /// Threads of the query worker pool (rayon global pool); default the cores; ingest/precompute/persist share the cores. + pub query_pool_threads: usize, + /// For tests: split inputs this small (RunContext::with_min_split_rows); None = executor default. + pub query_min_split_rows: Option<usize>, } impl QueryEngine { + /// Runs split by group key into `parallelism` parts; partition tasks and their worker CPU (ns) counted. + pub fn with_parallelism(self, parallelism: usize, min_split_rows: Option<usize>, tasks: Arc<AtomicU64>, cpu_ns: Arc<AtomicU64>) -> Self; } impl RunStore { + /// Raw reads read the ingest shards on rayon's workers (same batches, same order). + pub fn with_parallel_shard_reads(self, parallel: bool) -> Self; } pub struct Metrics { + /// `asap_query_parallel_tasks_total`: partition tasks the query runs ran on worker threads. + pub query_parallel_tasks: Arc<AtomicU64>, + /// `asap_query_parallel_cpu_seconds_total`: worker-thread CPU of those tasks and of parallel shard reads (included in phase="query"). + pub query_parallel_cpu_ns: Arc<AtomicU64>, + /// `asap_query_pool_threads`: the pool's actual size. + pub query_pool_threads: AtomicU64, } +/// Charges worker-thread CPU spent for this thread's runs; Timer / PhaseStats::record include it. +pub fn add_offloaded_cpu_ns(ns: u64);CLI:
--query-parallelism N,--query-pool-threads N.Algorithm changes
Round loop:
FuturesUnorderedover ready queries). Statuses, bindings, timeouts, group latency (round start → last member end) and record order are unchanged.Raw reads: shards are read in parallel and their batches concatenated in shard order, so the executor sees the same rows in the same order as a sequential read.
Tests
intent::tests::independent_queries_in_a_round_run_concurrentlyintent::tests::a_dependent_waits_for_every_upstreamtests/intent_sil_modes.rs::parallel_query_runs_answer_like_sequential_runs: all three planning modes, N = 1 vs 4, bit-identical answers; tasks > 0 with 4 and 0 with 1.Measurements
Quiet host: 2x E5-2683 v3, 56 threads, 251 GB; load ≤ 4 during the runs. Tool:
par_bench(in process; rows fed unpaced, windows closed, then 3 rounds 10 s apart). Each run is pinned withtaskset -c 0-(P-1)andQUERY_PARALLELISM=P, so the engine sees P cores (ingest shards = P/4). 3 reps per point (n = 9 rounds). Answers (every round, every value's bits) are identical across P = 1/8/28/56 and across reps.Workloads:
n1_5minfull-intent plan, synthetic x1, 6.4 M rows; q2 and q3 build per-host sums at query time.Label layout (this PR):
taskset 0-7leaves 2 ingest shards and raw reads convert per shard. With 8 shards (INGEST_THREADS=8) the median round is 2.04 s (4.9x).With #904's series-key layout (local combo #904 + #905;
packetskeyed bysrc_p16,authandflowsbyhost):The CPU column in these tables is the bench's sum over all
query*threads. Those runs used the binary from before the CPU-accounting fix. With the fix,phase="query"reports the same total.Deferred
RawData::read. Shards only for now, to stay out of the series-key branch's way.par_bench) lives with the eval tools, not in this repo.🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6boFpwkpMtRc1FnZuYi