Repository navigation
Rebuild perf-test hits datasets by re-inserting instead of attaching - #110009
Conversation
The performance-comparison setup attached the dataset tarballs directly, so the hits tables kept their frozen on-disk format: non-adaptive marks, no sparse serialization, no statistics, and a single pre-merged part. Changes to write-time defaults (for example sparse columns or `compute_exact_num_defaults_for_sparse_columns`) were therefore never exercised by the performance tests. Each server now re-inserts the attached datasets into its final tables on startup, then runs `OPTIMIZE ... FINAL` to collapse them back to a single part matching the original layout. The parts are written by that server's own binary and settings, so a PR that changes a write-time default is reflected on the tested (right) side. The left (reference) and right servers are populated independently and in parallel. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Workflow [PR], commit [92062c9] Summary: ✅
AI ReviewSummaryThis PR changes the performance-comparison setup so each server rebuilds the Findings
Final Verdict |
The CI performance job runs `ci/jobs/performance_tests.py`, which does its own dataset setup and only calls `compare.sh` for the report stage. The previous commit changed `compare.sh`'s `configure`/`restart`, which the CI never executes, so the re-insert never ran. Revert that dead change and implement the same logic in `performance_tests.py`. The configure step no longer starts a preconfig server to rename `datasets.hits_v1` to `test.hits`; the datasets stay attached as-is. After both servers start, each re-inserts its hits datasets and runs `OPTIMIZE ... FINAL` to collapse them back to a single part matching the original layout. Parts are written by that server's own binary and settings, so a PR changing a write-time default is reflected on the tested (right) side. Both servers are populated in parallel. Co-Authored-By: Claude Fable 5 <[email protected]>
…rver Removing the preconfig server also removed the side effect that created `ci/tmp/coordination0`, which the configure step copied into each server's keeper storage, so `cp` failed. Create each server's coordination dir directly instead; the embedded, non-replicated keeper bootstraps from an empty dir. Co-Authored-By: Claude Fable 5 <[email protected]>
The hits datasets are attached in Ordinary databases (default, datasets), and EXCHANGE TABLES is only supported in Atomic databases, so the in-place rebuild of hits_10m_single / hits_100m_single failed with NOT_IMPLEMENTED. Swap the freshly-built table in with a two-table RENAME, which works in Ordinary databases too. Co-Authored-By: Claude Fable 5 <[email protected]>
Each server rebuilt its three hits tables sequentially, so the two small tables (~20s each) added on top of hits_100m_single (~13min). Rebuild all three in parallel instead: the small tables finish within the big table's window, saving ~40s per shard. All tables still get OPTIMIZE FINAL to a single part, so no background merges run during the tests. Co-Authored-By: Claude Fable 5 <[email protected]>
Rebuilding the three tables in parallel on one server OOMed: the inserts share the per-user memory limit (~28GiB) and hits_100m_single alone uses ~21GiB, so the OvercommitTracker killed the concurrent test.hits insert. Go back to sequential rebuilds (the two servers are still populated in parallel, which fits since each has its own user memory tracker). Also stop using test.hits existence as the "done" marker: with rebuilds it was not a reliable signal (the in-place *_single tables exist from the tarball before being rebuilt). Create a dedicated test._populate_done marker only after all three tables are rebuilt, and drop any leftover target at the start of rebuild_table, so a retry after a mid-run failure re-runs the whole populate instead of skipping it. Co-Authored-By: Claude Fable 5 <[email protected]>
rebuild_table treated any missing source as a benign skip, so if an in-place dataset (default.hits_10m_single / default.hits_100m_single) failed to attach, populate_data still wrote test._populate_done and every later restart skipped the rebuild, leaving that dataset in the frozen tarball format. Only the datasets.hits_v1 -> test.hits retry (source already consumed into an existing destination) is a legitimate skip; every other missing source now raises so the job fails instead of silently marking an unrebuilt dataset as done. Co-Authored-By: Claude Fable 5 <[email protected]>
Only the hits datasets are re-inserted; tpch, tpcds and values still read their frozen tarball parts, so write-time defaults are not exercised on those workloads. Make that scope explicit in populate_data. Co-Authored-By: Claude Fable 5 <[email protected]>
eqmed.sql runs a randomization test for the median difference between the
two versions. It cross-joined each query's measurements with
numbers(1, 10000) and did `order by rand()`, so a query with 1000
measurements built and sorted 10M rows in memory: ~22 GiB peak and ~15s,
single-threaded. That 22 GiB spike is why the analyze stage caps
concurrency at MemTotal/15.
Two changes, same statistic (10000 iterations, exact medians):
- Keep each query's measurements as one array and reshuffle it per
iteration (arrayShuffle + arrayReduce('medianExactForEach', ...) on each
half), with max_block_size bounding how many shuffled copies exist at
once, instead of materializing and sorting numbers*T rows.
- Only randomize metrics that actually vary across the measurements. A
constant metric has identical medians in every split, so its threshold
is exactly 0 (which the old query also produced); most of the ~230
ProfileEvents are constant per query. The threshold is scattered back to
full width with 0 for the constant metrics.
Verified on 505 real query inputs from a CI run: the deterministic
columns (left/right medians, diff) are byte-identical, and the randomized
threshold is statistically identical (median ratio 1.0; the only
differences are Monte-Carlo boundary flips the old query shows run to run
as well). On the heaviest query (1000 measurements) peak memory drops
from 22.5 GiB to 788 MiB and time from 15.4s to 2.48s; total CPU over all
505 queries drops from 896s to 225s.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
get_profiles dumped `select *` from system.query_log for both servers (~120 MiB each, 85 columns), parsed downstream by analyze_queries and report(). Only six columns are actually read by the report (query_id, ProfileEvents, query_duration_ms, memory_usage, read_bytes, written_bytes); the rest are only ever looked at by a human debugging a run. Dump a curated set instead: the six report columns plus the ones useful for manual debugging (query text, Settings, timings, row/byte counts, exceptions). This drops ~70 niche columns (initial_query_*, transaction_id, thread_ids, used_*, client_*, microsecond-precision duplicates, ...) and shrinks each dump from ~120 MiB to ~92 MiB, so the artifact is smaller and analyze/report parse less. ProfileEvents and Settings, the two large columns, are kept. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ts-datasets Rebuild perf-test hits datasets by re-inserting instead of attaching
Since ClickHouse#110009 each perf server rebuilds hits_10m_single, hits_100m_single and datasets.hits_v1 -> test.hits itself: a 16-thread INSERT ... SELECT, then OPTIMIZE FINAL. The INSERT splits the rows into parts nondeterministically, and the vertical merge with variable adaptive granularity (blocks_are_granules_size in MergeTask) makes every merged granule follow the input parts' granules, so the left and right servers get different granule boundaries. order_by_read_in_order ClickHouse#1 reads in reverse order, only the last granule, whose size is the remainder of that layout: 510 vs 6041 rows on PR 117972 arm 2/6 (+18%), 958 vs 7977 on PR 119090 arm 4/6 (+50.9%). The layout lasts for the whole job, so the difference is perfectly separated and reproducible, and it reds shards. With use_const_adaptive_granularity the merged part's rows per granule is one constant computed from its total rows and bytes, capped at index_granularity. hits rows are 553-713 bytes, far below 10 MiB / 8192, so both servers get 8192-row granules. The setting only affects parts written while it is set, so it is reset after OPTIMIZE FINAL: the part keeps its granules, and CREATE TABLE ... AS clones (trivial_insert_select_from_files measures an INSERT into one) keep the default insert path. The double-check-perf-tests mirror of rebuild_table gets the same two statements, so --populate keeps matching CI. Validated on two local servers with the official master build and the CI datasets, driving the harness function itself: before, every rebuild pair differed (hits_100m_single query ClickHouse#1 read 7977 vs 993 rows); after, all pairs are identical (256 rows). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Performance tests populated the
hitstables (test.hits,hits_10m_single,hits_100m_single) by attaching the dataset tarballs directly, so the parts kept their frozen on-disk format: non-adaptive marks, no sparse serialization, no statistics, and a single pre-merged part. Write-time default changes (for example sparse columns, statistics, or in the near futurecompute_exact_num_defaults_for_sparse_columns) were therefore never exercised on these datasets.Now each server re-inserts the
hitsdatasets into its final tables on startup, then runsOPTIMIZE ... FINALto collapse them back to a single part matching the original layout. The parts are written by that server's own binary and settings, so a PR that changes a write-time default is reflected on the tested (right) side. The left (reference) and right servers are populated independently and in parallel; within a server the three tables are rebuilt sequentially (concurrent inserts would exceed the per-user memory limit).Scope: this covers the
hitsdatasets, which back the bulk of the suite (includingclickbench.xml). The other attached datasets (tpch,tpcds,values) are still read from their frozen tarball parts, so write-time defaults are not yet exercised on those workloads; rebuilding them the same way can be a follow-up.Marked with the
ci-performancelabel so the Performance Comparison runs on both AMD and ARM (ARM runs by default; the label enables AMD).Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Version info
26.7.1.1215(included in26.7and later)