Repository navigation
Perf CI: fail a PR when a query of a test it adds or changes gets slower run over run - #129330
Conversation
…wer run over run perf.py repeats every measured query on the same tables without a reset. A query that changes what its next run reads (a growing table, an UPDATE that rewrites its own rows, a file each run appends to) gets slower run over run and is then noisy on master for weeks: 8 of the 10 noisiest tests of the last round in ClickHouse#100759 were this class, all fixed after merge. A PR run could not notice: its status ignores slower/unstable rows, and the A/B diff of a new test mixes noise with the PR's own change. In master_head PR runs (not nightly, not the Iceberg configuration), read the job's own analyze/query-runs.tsv for the tests the PR adds or changes and fail Check Results when a query has, on the tested server, at least 5 runs with corr(run, time) > 0.8 and last/first > 1.2. Only the tested server counts: after the merge both master servers run that code, and requiring both servers drops recall to 0.34-0.94 of heads on last round's offenders against 0.60-0.98. One FAIL child per query carries both servers' run times. A missing file or a malformed row of a changed test fails the check; unknown changed files add a workflow warning instead. test_discovery.changed_tests is the selection, which changed_iceberg_tests now reuses. Validated on 16 real job logs: flagged on master before ClickHouse#127696 / ClickHouse#127380 and on all 8 head jobs of ClickHouse#119147, not flagged after the fixes, 1 of 273 tests on today's master (a query rising on both servers). Related: ClickHouse#100759 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A run-trend row had the same name as a dashboard row of its query, so it was dropped when the dashboard also flagged that query: Check Results failed with no trend data shown, and a trend row in turn hid the query's slower/unstable row. Name it `<test> #<i> run trend`, append every one, and print each to the job log. The README states the 5-run floor and the 10-query sample of PR jobs. Related: ClickHouse#100759 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (click to expand)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261104-133000 |
|
cc @egor-click, could you review this and add the |
|
Workflow [PR], commit [cde1f15] Summary: ✅
AI ReviewSummaryPR #129330, reviewed at Final VerdictStatus: ✅ Approve |
|
|
||
| children = [ | ||
| Result( | ||
| name=f"{t['test']} #{t['query_index']} run trend", |
There was a problem hiding this comment.
@groeneai Can we make both the name and the test clearer please? "run trend" isn't clear to me. Something like "Query test#1 time keeps growing/decreasing in each execution" seems better. Also maybe we can point to the larger description in the README too
There was a problem hiding this comment.
Done in fc513c7. Each row is now named Query <test> #<i> time keeps growing with each run, and its text reads, for example:
Run times on the tested server, s: 1.326, 1.385, 1.46, 1.158, 1.596, 2.368, 2.43; on the reference server: 1.094, 1.269, 1.347, 1.53, 1.365, 2.359, 2.044. Correlation of run number and time 0.82, last run / first run 1.83 (the check fails above 0.8 and 1.2). Usually each run reads what the previous runs changed, for example a table or file that grows; make every run do the same work. See "Queries whose time keeps growing with each run" in tests/performance/README.md.
The README paragraph now has its own section with that heading, and the row links to it. The summary line, the warning and the error message use the same wording.
I kept the check to growing times. The mirror rule for decreasing times would flag 0.94-0.98% of amd and 0.29-0.31% of arm test jobs on master on 11-03 and 11-04 (growing: 0.48-0.53% and 0.32%), mostly read-only tests such as generate_random_json (23% of its amd jobs), clickbench and sort_patterns.
Review on ClickHouse#129330 asked for a clearer name and text than "run trend" and for a pointer to the README. Each row is now named "Query <test> #<i> time keeps growing with each run"; its text gives both servers' run times, the two values against the thresholds, the usual cause and the README section, and the row links that section. The README paragraph moves under its own heading so the link has an anchor. The summary, warning and error strings use the same wording. Which queries fail is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check of the tests a PR adds or changes (ClickHouse#129330) failed a PR only when a query's time grows run over run on the tested server. A test whose runs are noisy without a trend passed its own PR, and in master_head PR mode the report's own unstable/changed verdict never fails a PR. That is how system_clusters_replicated_databases (ClickHouse#122223) got in: tested-server spread (stddevPop / median of its runs) 0.41-2.1 in its PR, now > 0.5 on both master servers in about 99% of runs and the noisiest test on master. The check now also fails on an unstable query of such a test: - PR changes only files under tests/ and the reference is the performance reference build of the tested master commit's sources (find_prev_build's new third value; a reference of an older commit, as in about a quarter of PR jobs, does not count): both servers run the same code built the same way, so the report's verdict judges the test; fail on changed_fail or unstable_fail of report/all-queries.tsv. A query that failed on the reference server and ran only on the tested one is not in that file; it is judged by the rule below. - Any other PR or reference (code changes, the official-build fallback, or an older reference): the report measures the PR's change, not the test (the floors flag 79% of the heads of the 214 code PRs that changed a perf test in 2026-11-12..21, their own speedups). Fail when stddevPop / median of the tested server's runs is above 0.5 (at least 5 runs). A spread the change causes also fails: after the merge both master servers run that code. The bar 0.5 flags 0.5% of those code-PR heads and 0.2% of quiet tests' master heads (CIDB backtest), and all 4 jobs of ClickHouse#122223. A query the trend check already reports gets only its trend row. The reading loop of find_run_trends moves to read_query_runs, shared by both checks; run_trend_gate becomes changed_tests_gate. Validated locally on downloaded job logs (no test of the test infrastructure): ClickHouse#122223's 4 jobs fail (the old check passes them); the new tests of ClickHouse#129328, ClickHouse#124553, ClickHouse#131203 (code PRs) and the tests-only ClickHouse#130763, ClickHouse#129627 pass; the run-trend output is unchanged on all 1754 tests of 14 jobs. Related: ClickHouse#100759 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #100759
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required: CI-only change.
Description
perf.pyruns each query 5-7 times (up to 30) on the same tables without resetting anything. A query changing what its next run reads (a table that grows with each timedINSERT, anUPDATErewriting its own rows) gets slower run over run and stays noisy on master for weeks: 8 of the last round's 10 noisiest tests in #100759 were this class, all fixed after merge. Nothing stops it today: the PR status ignoresslower/unstablerows, and a new test's A/B diff mixes noise with the PR's own change.In
master_headPR runs (not nightly, not Iceberg),Check Resultsfails when a query of a test the PR adds or changes has, on the tested server, at least 5 runs withcorr(run, time) > 0.8and last/first > 1.2. It reads the job's ownanalyze/query-runs.tsv(no extra run). One FAIL row per query shows both servers' run times. The check fails closed if the file is missing or has a malformed row; if the changed files are unknown, it adds a workflow warning instead.Validated on 16 real job logs: on master before #127696 and #127380,
polymorphic_parts_m(amd) andiceberg_suite_local_rw_features(amd and arm) are flagged; after them they are not. The PR that addediceberg_suite_local_rw_features(#119147) would have failed on all 8 of its head jobs. On today's master it flags 1 of 273 tests, a query rising every run on both servers.Limits: it checks only the queries the job runs (at most 10 random ones per test, unless
run_all_queries="1"), and a PR runs the amd jobs only withpr-performanceor a performance category. It does not catch level shifts, wide spread or rare slow runs, and changed.xml.inc,.sqlor.jsonfiles are not mapped to the tests that use them.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/129330]
Version info
26.11.1.1879-master(included in26.11and later)