Skip to content

Stabilize four noisy performance test queries - #122458

Merged
alexey-milovidov merged 1 commit into
masterfrom
perf-tests-stabilize-noisy-queries
Sep 26, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
perf-tests-stabilize-noisy-queries

Conversation

@fm4v

@fm4v fm4v commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Related: #120927
Related: #122073

Four performance test queries were flagged on master runs of the same code, and were scored as confirmed regressions by the performance dashboard on unrelated PRs, because the two compared servers did not measure the same work. This makes the work identical on both servers, and moves two of the queries that ran in under 20 ms well above 100 ms. set_index #0 stays at about 40 ms: its work is now deterministic, and making it longer would change what it measures.

Query Master flag rate, 14 days Cause Change
and_compare_chain_derived #2 5-8% numbers_mt writes a varying number of parts and the measured runs stop merges, so the servers read different layouts (34 ms over 17 parts, 82 ms over one part, same binary); 20 ms query Merge both tables to one part and check it with throwIf; bound 8000000 < l.v keeps 2M rows per side, about 150 ms
set_index #0 14% (arm) IN set built from rand: every run looks up a different set and reads a different number of rows before read_overflow_mode = 'break' Fixed pseudo-random set toUInt32(cityHash64(number)), merge the table to one part
formats_columns_nullable #1 (and the other formats of that template) 19% (arm) 6-10 ms query; parallel parsing parses a varying amount ahead before LIMIT cancels it (LIMIT 30000 of CSV: 197 ms with it, 38 ms without) LIMIT 100000 with input_format_parallel_parsing = 0 for that query only, about 200 ms for text formats
serialization_pool_lookup #0 9.3% (amd), 0.4% (arm) max_threads = 16 oversubscribes the 8 cores the amd servers are pinned to Use the harness default, one thread per pinned CPU

The edited tests pass through perf.py --stop-merges locally on a master build.

Found in a 24-hour sweep of PR perf failures (312 of about 2540 PR shards red, 246 of them without a single slower query).

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Stabilize four noisy performance test queries.


Workflow [PR]
Sync PR [sync-upstream/pr/122458]

Version info

  • Merged into: 26.10.1.778-master (included in 26.10 and later)

These queries were flagged as slower/faster/unstable on master runs, or scored as confirmed regressions by the performance dashboard on unrelated PRs, because the two compared servers did not measure the same work:

- `and_compare_chain_derived`: both tables are created with `numbers_mt`, which writes a varying number of parts, and the measured runs stop merges, so the servers read different layouts (the join query took 34 ms over 17 parts and 82 ms over one part on the same binary). Merge each table to one part and check it. Query 2 now keeps 2M rows per side (`8000000 < l.v`) and runs at about 150 ms instead of 20 ms.
- `set_index`: the IN set was built from `rand`, so every run looked up a different set, selected different ranges and read a different number of rows before `read_overflow_mode = 'break'`. Use a fixed pseudo-random sample (`toUInt32(cityHash64(number))`) and merge the 500M-row table to one part.
- `formats_columns_nullable`: `SELECT * ... LIMIT 1000` read 6-10 ms, and parallel parsing parsed a varying amount ahead before the LIMIT cancelled it (`LIMIT 30000` of CSV took 197 ms with it and 38 ms without). Disable parallel parsing for that query and read 100000 rows, about 200 ms for text formats.
- `serialization_pool_lookup`: the fixed `max_threads = 16` oversubscribed the 8 pinned cores of the amd runners; query 0 was flagged in 9.3% of amd master runs against 0.4% on arm. Use the harness default of one thread per pinned CPU.

Master flag rates over 14 days (slower/faster/unstable share of master runs): `and_compare_chain_derived #2` 5-8%, `set_index #0` 14% (arm), `formats_columns_nullable #1` 19% (arm), `serialization_pool_lookup #0` 9% (amd).
@clickhouse-gh

clickhouse-gh Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ab0976a]

Summary: ✅


AI Review

Summary

This PR stabilizes four noisy performance benchmarks by fixing nondeterministic inputs, lengthening short queries, and forcing stable part layouts where the measured runs stop merges. I found one benchmark-contract issue in serialization_pool_lookup.xml: the max_threads change relies on a perf-harness default that is not actually "one thread per pinned CPU" on arm CI, so the test no longer does what the new comment and PR rationale say.

Findings

⚠️ Majors

  • [tests/performance/serialization_pool_lookup.xml:9] Dropping the test-local max_threads = 16 does not leave CI at "one thread per pinned CPU" on all architectures. tests/performance/scripts/config/users.d/perf-comparison-tweaks-users.xml:19 hard-codes max_threads = 12, and ci/jobs/performance_tests.py:611-622 only overrides that on x86_64. On arm this change reduces the workload from 16 threads to 12 rather than preserving the 16-thread contention path while only de-oversubscribing amd. If that is intentional, the comment and PR rationale need to say so; if the intent is truly one thread per pinned CPU, the harness/profile needs the architecture-specific fix.
Final Verdict
  • Status: ⚠️ Request changes
  • Keep serialization_pool_lookup consistent with the actual perf harness defaults: either restore an explicit thread count here and make the de-oversubscription fix architecture-specific in CI, or change the harness/profile so the default really is one thread per pinned CPU on both architectures.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 26, 2026
This measures the pool's hit path under contention.
-->
<!--
`max_threads` is left at the harness default, which is one thread per CPU the servers are pinned to.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/performance/scripts/config/users.d/perf-comparison-tweaks-users.xml:19 hard-codes max_threads = 12, and ci/jobs/performance_tests.py:611-622 only rewrites that on x86_64. So removing the local <max_threads>16</max_threads> does not leave this benchmark at "one thread per CPU the servers are pinned to" on arm CI; it drops the arm workload from 16 threads to 12 too. If the intent is really "use one thread per pinned CPU", that has to be enforced in the perf harness/profile or with an architecture-specific override, otherwise this comment and the benchmark contract are wrong.

@alexey-milovidov alexey-milovidov self-assigned this Sep 26, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 26, 2026
Merged via the queue into master with commit 010807a Sep 26, 2026
172 checks passed
@alexey-milovidov
alexey-milovidov deleted the perf-tests-stabilize-noisy-queries branch September 26, 2026 23:16
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 26, 2026
middas-0706 pushed a commit to middas-0706/ClickHouse that referenced this pull request Oct 3, 2026
Since ClickHouse#122458 the first query of the test (#0-ClickHouse#7, one per format) is
SELECT * ... LIMIT 100000 with input_format_parallel_parsing = 0, so the
text formats are parsed in one thread. On ARM the speed of that parse is
fixed per server process: the 7 runs of one server agree within 1-2%,
while different servers take 0.26-0.55 s for ClickHouse#2 (JSONEachRow). In the
failing job on ClickHouse#101022 (+54.9%, 0.338 -> 0.524 s) the confirmation
restart drew new levels for both servers (0.293 and 0.345 s), and the
slow side read the same rows and bytes with 1.58x the user CPU. ClickHouse#1 and ClickHouse#2
share the factor within a process (r = 0.86); it does not reach the
other 80 queries of the same processes, which read the same files with
parallel parsing. Why the single-threaded parse is per process on ARM is
not established.

Runs whose two servers differ by more than 15% (query_metric_runs_v1,
raw samples, since 2026-09-27):

                         arm PR   arm master   amd PR   amd master
    #0 TSVWithNames      38/200      5/33       0/48       0/42
    ClickHouse#1 CSVWithNames     111/191     19/35       0/42       0/30
    ClickHouse#2 JSONEachRow      112/199     15/31       0/34       0/32
    ClickHouse#3-ClickHouse#7 binary          1/982      0/188      0/180      0/185

The 80 parallel-parsing queries on the text formats: 0 of 7232 ARM runs.

Read the whole file with the default parallel parsing instead: without a
LIMIT the amount parsed does not depend on read-ahead (why ClickHouse#122458
disabled parallel parsing), and no text format is parsed in one thread.
Avro has no parallel parsing, so ClickHouse#3 now takes about 2.7 s on ARM
(report-only "too long"; ClickHouse#75 of this test is already 2.16 s). The text of
#0-ClickHouse#7 changes, ClickHouse#8-ClickHouse#87 are unchanged.

Local check on x86 with the official 26.10.1.1403 master build, server
pinned to 16 cores with max_parsing_threads = 16, perf.py, 7 runs: new
#0-ClickHouse#2 0.43, 0.47 and 0.96 s with 3% spread, ClickHouse#3 2.15 s, ClickHouse#4-ClickHouse#7 0.09-0.53 s;
every query reads all 2000000 rows of the file, #0-ClickHouse#2 in 7-15 threads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-testing Test content only (no production code). pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants