Repository navigation
Don't allocate memory in the pipeline executor after every executed task - #124818
Conversation
`ExecutingGraph::updateNode` allocated its two work stacks and `PipelineExecutor::executeStepImpl` allocated two queues of processors for every executed task. Now they are kept between the tasks. With small blocks this was a noticeable part of the time of `ExecutingGraph::updateNode`. Related: #124795 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [034e9f2] Summary: ✅
AI ReviewSummaryPR #124818 reuses the pipeline executor's task queues and Final VerdictStatus: ✅ Approve. No required changes or new inline comments. |
Build profile diff (arm_release)Commit See the job log for details. |
|
📊 Cloud Performance Report 🟢 AI verdict: This PR keeps the updateNode working buffers and task queues alive across tasks in the pipeline executor, so it no longer allocates memory-tracked containers after every processor run. Every query runs this code. The clearest effect is on the short, highly parallel clickbench Q20: -41.4% faster (220 ms to 129 ms), with CPU time nearly halved. That change is large and consistent and stands as an improvement. Clickbench Q33 shows -6.1%, but that falls inside master's normal range for this noisy, aggregation-heavy query, so it stays at no change. tpch_adapted_1_official has no flagged queries. clickbench🟢 1 improved Flagged queries (1 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
…e-allocations Resolve the conflict in `ExecutingGraph.cpp`: master switched the scratch containers of `updateNode` to the `-WithMemoryTracking` aliases; use them for the members of `UpdateNodeBuffers`.
…utor The executor keeps `Queue` and `UpdateNodeBuffers` between executed tasks to avoid allocations. A single wide wave of ready processors could make them grow and hold that memory until the end of `executeStepImpl`. Release a buffer instead of reusing it when it has grown past `UpdateNodeBuffers::max_kept_capacity` elements. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e call Previously oversized `UpdateNodeBuffers` were released only at the beginning of the next `updateNode` call, so a worker thread waiting for the next task could keep the memory of a wide wave of updates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124818&sha=2ecc3eafad1ce0b9dc68d5bfff6c3ed9177521ae&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%201%2F6%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. ( |
|
I measured it in CIDB (
#125094 makes the targets created in |
|
I opened #125488 as the fix. It compiles A slow #125094 arm binary and a fast one on the same base differ only in 122 functions of these three libraries (TLS descriptor sequences and GOT loads instead of direct accesses). I have not found how that slows the hash-join build on Graviton, so the arm performance run of #125488 is the A/B: since master is now in the slow state, |
|
🕵 Thanks @groeneai for the analysis: the |
…e-allocations # Conflicts: # src/Processors/Executors/Runtime/V1/PipelineExecutor.cpp
|
🕵 The only failure on |
# Conflicts: # src/Processors/Executors/Runtime/V1/PipelineExecutor.cpp
After executing every task,
PipelineExecutor::executeStepImplcreated two queues of processors, andExecutingGraph::updateNodecreated its two work stacks (boost::container::devector) and a vector. The first push into each of them allocated memory, freed at the end of the call. With small blocks this is done for every block of every processor:ExecutingGraph::updateNodewas 9-21% of the time of ClickBench queries withmax_block_size = 1, and the allocations (devector::insert_range_slow_pathand the matchingoperator delete) were a noticeable part of it.Now the queues and the work stacks are kept by
executeStepImplbetween the tasks and passed toupdateNode(ExecutingGraph::UpdateNodeBuffers). They are cleared before use, in case a previous call stopped early or threw.Measured on ClickBench
hits(a 1% subset, 1M rows), single-threaded, together with the other PRs for the same issue (#124791): withmax_block_size = 16, queries Q3, Q10, Q19, Q30, Q34 are 13-25% faster; with the defaultmax_block_sizethe times are unchanged.Related: #124795
Related: #124791
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The pipeline executor no longer allocates memory for its work queues after executing every task, which reduces the overhead of processing a block.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124818]
Version info
26.10.1.2511-master(included in26.10and later)