Skip to content

Faster and cheaper PR CI: earlier stage 2, shorter tail, cross-compiled builds in the merge queue - #131576

Merged
fm4v merged 4 commits into
masterfrom
ci-shard-arm-binary-sequential
Nov 14, 2026
Merged

fm4v merged 4 commits into
masterfrom
ci-shard-arm-binary-sequential

Conversation

@fm4v

@fm4v fm4v commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Makes the public PR workflow finish sooner and costs less, without dropping the gate that keeps broken PRs from spending stage-2 runners.

Estimated effect, modelled on the latest full run of each of 100 PRs (2026-11-13..2026-11-14, GitHub jobs API), minutes from the run start:

Stage 2 starts, p50 / p90 Run ends, p50 / p75 / p90
Before 81 / 157 183 / 234 / 280
After 60 / 82 145 / 165 / 185

Changes:

  1. Stateless tests (arm_binary, sequential) is split into two batches.
  2. Integration tests (amd_asan_ubsan, db disk, targeted) is no longer part of CORE_BLOCKING_JOB_NAMES; it still starts right after its build and stays required.
  3. Integration tests (arm_binary) runs in 5 batches instead of 4, and integration jobs run 4 pytest workers instead of 3.
  4. PRs run Stateless tests (arm_asan_ubsan, azure, targeted) instead of the full azure suite (master keeps it).
  5. SQLLogic test and SQLStorm test move from the PR workflow to NightlySQLancer (master keeps them).
  6. 10 cross-compiled builds move from the PR workflow to the merge queue (master keeps them).

Cost per week at ~2260 PR commits: about -$5.5k (azure suite), -$3.4k (cross builds), -$1.3k (SQL suites), +$1.4k (stage 2 now also runs on the 2.1% of commits that failed only the ASan integration job), plus small setup costs of the extra batches.

1. Split Stateless tests (arm_binary, sequential)

Stage 2 (about 145 jobs) waits for CORE_BLOCKING_JOB_NAMES, and this was its slowest job: 1231 sequential tests, 47.9 minutes in total, ending about 25 minutes after the rest of the gate. Gate jobs, public CIDB, PR runs from 2026-11-07 to 2026-11-14:

Gate job p50 p90
Stateless tests (arm_binary, sequential) 51.2 min 52.6 min
Integration tests (amd_asan_ubsan, db disk, targeted) 41.4 min 120.5 min
Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted) 31.9 min 32.2 min
Unit tests (tsan) 24.2 min 25.1 min
Stateless tests (amd_debug, parallel) 17.6 min 18.7 min
Stateless tests (arm_binary, parallel) 11.6 min 12.4 min

With crc32(file) % 2 (as in clickhouse-test --run-by-hash-*) the batches hold 24.4 and 23.5 minutes of tests, about 30 minutes per job with setup. The extra pr-arm-small job costs about $0.03 per commit. Dropping the lane from the gate instead would have cost about 20x more: it was the only failing gate job on 2.1% of PR commits, each of which would then run stage 2 (about $30).

Example of the delay: run https://github.com/ClickHouse/ClickHouse/actions/runs/43497656163 of PR #131389 created 139 stage-2 jobs at minute 76, while the other gate jobs had ended by minute 56.

2. Do not gate on Integration tests (amd_asan_ubsan, db disk, targeted)

Its coverage-based selection grows with the PR: on 30% of PR commits it ran 90 minutes or more (median 78 modules). After change 1 it is the last gate job in 46 of 100 runs; large PRs, which are also the only ones that run the stress, fuzzer and SQL jobs, started stage 2 at 125-150 minutes. Over 14 days it was the only failing gate job on 99 of 4646 PR commits (2.1%). Stage 2 has integration jobs of its own (the full arm_binary run and the amd_tsan, amd_msan and arm_binary targeted ones), so a PR that breaks integration tests still fails early. Sharding it was rejected: the targeted path would need batching, every shard would repeat the CIDB selection, and large selections would still take 40-55 minutes.

3-5. The slowest stage-2 jobs

After changes 1-2 the run would still end at 163 / 175 / 197 minutes (p50 / p75 / p90). The jobs that ended it:

Job Ends the run p50 Change
Integration tests (arm_binary) 32% 93 min 5 batches, 4 workers
SQLLogic test 25% 92 min NightlySQLancer
Stateless tests (arm_asan_ubsan, azure, parallel) 17% 85 min targeted
  • Integration workers: every integration job runs on a 16-vCPU runner with a 48 GiB nested budget, and worker_plan gave min(16 // 5, 48 // 11) = 3 workers, limited by CPU. With MAX_CPUS_PER_WORKER = 4 it is 4 workers at 12 GiB each (the model is 11 GiB). The --dist=each flaky check stays at 2 workers, limited by memory.
  • The azure suite failed in PRs at the same rate as on master over 30 days (1.55% vs 1.79% parallel, 0.76% vs 0.61% sequential) and does not block merges (allow_failure), so the full run found nothing specific to the PRs, at about $2.9 per PR commit. The targeted job runs the changed tests, the tests covering the changed lines and the previously failed ones, like the other sanitizer configurations.
  • Over 30 days 1 of 5169 PR commits failed SQLLogic test and none of 5458 failed SQLStorm test.

6. Cross-compiled builds to the merge queue

amd_darwin, arm_v80compat, amd_freebsd, amd_illumos, ppc64le, amd_compat, amd_musl, riscv64, s390x and loongarch64 cost about $2.4 per PR commit together. PRs in which the build was the only failing build, 2026-09-15 to 2026-11-14 (about 18,600 PR commits):

Build PRs $ per run
ppc64le 12 0.23
amd_freebsd 3 0.22
amd_compat, s390x, amd_illumos 2 each 0.22-0.24
amd_darwin, amd_musl, riscv64, loongarch64 1 each 0.21-0.31
arm_v80compat 0 0.23

The merge queue runs about 850 times a week, so it still stops these breakages before master at about a third of the cost. The builds need only the source and take 6-9 minutes, so they end long before Stateless tests (amd_binary, flaky check) (p50 24 minutes) and add no queue latency. In the queue they only compile: no artifacts (nothing there uses them) and no post hooks, because without a PR number build_master_head_hook.py would publish the binaries as the master ones and build_profile_hook.py would record a master baseline. Kept in PRs: Build (arm_darwin) (needed by Fast test (arm_darwin)), Build (wasm64) (14 PRs) and Build (arm_fuzzers) (66 PRs).

Related: #131389

Changelog category (leave one):

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

Version info

  • Merged into: 26.11.1.2311-master (included in 26.11 and later)

The job is in `CORE_BLOCKING_JOB_NAMES` of the PR workflow, so stage 2 (about 145 jobs) waits for it. Its sequential tests take about 48 minutes in total, so it ended about 25 minutes after the rest of the gate on most PR runs. With two hash batches each one takes about 24 minutes of tests, in line with the other gate jobs.

Example: https://github.com/ClickHouse/ClickHouse/actions/runs/43497656163 (PR #131389)
@clickhouse-gh

clickhouse-gh Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [457109b]

Summary: ✅


AI Review

Summary

Reviewed PR #131576 at 457109b9a86c86d7656e0b400a7b07c6c6bf729b. It shortens PR CI through sharding, targeted Azure tests, earlier stage 2, and moving cross-compiled builds and SQL suites to other workflows. No actionable findings. Focused configuration checks passed, including dependency graphs and complete, non-overlapping assignment of all 1,218 integration modules. Runtime memory use and the projected time/cost savings were not measured during this review.

Final Verdict

✅ Approve. No required changes or new inline comments.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 14, 2026
`amd_darwin`, `arm_v80compat`, `amd_freebsd`, `amd_illumos`, `ppc64le`, `amd_compat`, `amd_musl`, `riscv64`, `s390x` and `loongarch64` ran on every PR commit (about 2260 a week, about $2.4 per commit together) but were the only failing build in 25 PRs over 2026-09-15 to 2026-11-14. The merge queue runs about 850 times a week, so it catches the same breakages before they reach master for about a third of the cost. They need only the source, so in the queue they start right away and end before the flaky check. Master still builds them on every commit.

In the queue they only check that the code compiles: no artifacts, and no post hooks, because without a PR number `build_master_head_hook.py` would publish the binaries as the master ones and `build_profile_hook.py` would record a master baseline.

`Build (arm_darwin)` stays in pull requests because `Fast test (arm_darwin)` needs its binary, as do `Build (wasm64)` and `Build (arm_fuzzers)`, which catch breakages more often.
@fm4v fm4v changed the title Split Stateless tests (arm_binary, sequential) into two batches PR CI: split arm_binary, sequential in two, move 10 cross-compiled builds to the merge queue Nov 14, 2026
`Integration tests (amd_asan_ubsan, db disk, targeted)` selects tests by the coverage of the changed lines, so its duration grows with the PR: p50 41 min, p90 120 min, and on 30% of PR commits it ran 90 minutes or more. As a gate job it held back stage 2 on large PRs by up to an hour. It still starts right after its build and stays required.

Modelled on the latest full run of each of 100 PRs (2026-11-13..2026-11-14), stage 2 would start at p50/p75/p90 59.9/65.0/81.7 minutes, against 64.5/128.7/156.7 with only the `arm_binary, sequential` split, and 80.9/128.7/156.7 before. It was the only failing gate job on 99 of 4646 PR commits (2.1%) over 14 days, which would now run stage 2 (about $30 each, about $1.4k a week).
@fm4v fm4v changed the title PR CI: split arm_binary, sequential in two, move 10 cross-compiled builds to the merge queue PR CI: start stage 2 earlier, move 10 cross-compiled builds to the merge queue Nov 14, 2026
…, 5 integration shards, 4 workers

- `SQLLogic test` and `SQLStorm test` move from the PR workflow to `NightlySQLancer` (master keeps them). Over 30 days 1 of 5169 PR commits failed `SQLLogic test` and none of 5458 failed `SQLStorm test`; `SQLLogic test` took 92 minutes and ended the PR run in a quarter of the runs.
- PRs run `Stateless tests (arm_asan_ubsan, azure, targeted)` instead of the full azure suite (master keeps it). Its PR failure rate equalled master's (1.55% vs 1.79% parallel, 0.76% vs 0.61% sequential), and at 85-100 minutes it ended a sixth of the PR runs.
- `Integration tests (arm_binary)` is split into 5 batches instead of 4: a batch took about 93 minutes and ended a third of the PR runs.
- Integration jobs use 4 CPUs per pytest worker instead of 5, so the 16-vCPU runners run 4 workers instead of 3. Their 48 GiB nested budget gives each worker 12 GiB, above the 11 GiB model; the `--dist=each` flaky check stays at 2 workers, limited by memory.
@fm4v fm4v changed the title PR CI: start stage 2 earlier, move 10 cross-compiled builds to the merge queue PR CI: start stage 2 earlier, shorten its slowest jobs, move 10 cross-compiled builds to the merge queue Nov 14, 2026
@fm4v fm4v changed the title PR CI: start stage 2 earlier, shorten its slowest jobs, move 10 cross-compiled builds to the merge queue Faster and cheaper PR CI: earlier stage 2, shorter tail, cross-compiled builds in the merge queue Nov 14, 2026
@fm4v
fm4v enabled auto-merge November 14, 2026 10:29
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Nov 14, 2026
@fm4v
fm4v added this pull request to the merge queue Nov 14, 2026
Merged via the queue into master with commit 51764aa Nov 14, 2026
194 checks passed
@fm4v
fm4v deleted the ci-shard-arm-binary-sequential branch November 14, 2026 15:54
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 14, 2026
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-ClickHouse__ClickHouse that referenced this pull request Nov 15, 2026
The new `Stateless tests (arm_asan_ubsan, azure, targeted)` job (ClickHouse#131576)
runs the test 50 times on one server with fixed settings. `query_23`
(`... WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10`) is a TopK
read: with the default `use_query_condition_cache = 1` every run stores
the granules the TopK filter dropped, and the next run starts from them.
The selection shrinks run over run (CI: 383, 26, 16, 9 marks),
`ReadCompressedBytes` falls more slowly than the estimate, and the ratio
crosses the test's 2x bound once it converges (2.005x / 2.022x on ClickHouse#109377
and ClickHouse#129198). Randomized jobs never converge because the cache and TopK
settings are re-drawn per run.

Pin `use_query_condition_cache=0` test-wide, as the sibling estimation
tests 03801 and 04102 already do; the cache with autopr stays covered by
03783_autopr_dataflow_cache_reuse_qcc.

Locally, unpatched at CI's thread count: red from run 4-5 (8-9 marks,
2.02-2.04x); patched: 10/10 with a constant 1084 marks, and 50/50 with
random settings.

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-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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.

2 participants