Skip to content

Merge the polymorphic_parts_{s,m,l} performance tests into one - #129457

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:perf-merge-polymorphic-parts
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:perf-merge-polymorphic-parts

Conversation

@groeneai

@groeneai groeneai commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #129258

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):

...

Description

Item 3 of #129258: polymorphic_parts_s, _m and _l had the same tables, fill and queries. They differed only in the insert block size (max_block_size = min_insert_block_size_rows = 1 / 100 / 1000, file-level settings), the row counts, and async_insert = 0, which #111663 set for s and m but not l. They are now one file, polymorphic_parts, with the same nine queries.

The block sizes move into each INSERT's SETTINGS, together with async_insert = 0 for the six s and m queries, so every insert keeps its settings and insert route (l keeps the default route). A size substitution gives each size its own hits_wide_*, hits_compact_* and hits_buffer_* tables, so each insert sees the same table history as before. iceberg_skip_list.txt lists the new file instead of the three old ones, so this PR also runs the Iceberg performance jobs (not required).

Validation: a local A/A run of the CI amd release binary (two servers on the same 8 CPUs, 6 repetitions of old and new files) gave the same parts, files, rows, settings and synchronous-insert reason for every insert. The merged file is a little slower and noisier: per query, the median time was 2-8% above the old files (geomean of 6 reps), and perf.py's stat threshold (median of 6 reps) was 0.04-0.06 vs 0.03-0.06 for eight queries and 0.09 vs 0.05 for l0 (0.10 vs 0.04 with l0 run last).

The perf history is keyed by test name, so the merged test is judged at the default floors (0.15 / 0.25) until it has a week of master runs. The saving is small, about 1.5 s per arch and commit: most of the unmeasured time is the teardown DROP (92-102 s for the three per arch), which scales with the parts written.

🤖 Generated with Claude Code


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

The three files had the same tables, fill and queries and differed only in
the insert block size (file-level max_block_size = min_insert_block_size_rows
= 1 / 100 / 1000), the row counts, and async_insert = 0 in s and m (not l).
perf.py settings are file-level, which is why there were three files.

The block sizes, and async_insert = 0 for the six s and m queries, move into
each INSERT's SETTINGS, so every insert keeps its settings and insert route;
the l queries keep the default async_insert route, as before. A `size`
substitution gives each size its own hits_wide_*, hits_compact_* and
hits_buffer_* tables, so each insert sees the same table history as when the
sizes were separate tests. max_insert_threads = 1 stays file-level.
iceberg_skip_list.txt lists the new file instead of the three old ones.

Local A/A, CI amd release binary of 86abc2f, two servers on CPUs 0-7,
6 repetitions of the old files, the new file, the new file with l0 run last
and the old l file with l0 run last:
- every insert of every variant: the same InsertedWideParts,
  InsertedCompactParts, FileOpen and written_rows (e.g. s0 50/0/23750/50,
  l2 100/0/47500/100000), the same Settings[...] and the same synchronous
  insert reason as the old files, no delayed inserts;
- per query median time new/old, geomean of 6 reps: 1.018 .. 1.078;
  perf.py stat_threshold, median of 6 reps: new 0.044 .. 0.090, old
  0.026 .. 0.062;
- l0 run last, new vs old: geomean 1.049, stat_threshold 0.096 vs 0.043.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

groeneai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 2 findings) plus my own review (1 nit).

# Sev Finding Verdict Evidence / action
1 ❌ Do not open this while the #129258 series is paused DISAGREE Resumed by a maintainer on 2026-11-05: #129366 (comment 6653487300) and #129258 (comment 6653497830)
2 ⚠️ Merges of the other sizes' tables keep running while a size is measured, so the sizes are no longer isolated DISAGREE Mechanism is real, but the local A/A shows the same parts, files, rows, settings and insert route per insert; time and noise stayed inside the pre-set bounds, and the cost (2-8% slower, l0 noisier) is in the description. A per-size cleanup needs a perf.py change
3 💡 The description gave the new stat threshold without the old one AGREE, fixed The description now gives old vs new

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-11:20261105-091400

@groeneai

groeneai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? N/A as a bug repro (test maintenance, no defect). Deterministic oracle of "same benchmark": perf.py --print-queries of old and new files (every new query = old query, table renamed, plus SETTINGS max_block_size = B, min_insert_block_size_rows = B and async_insert = 0 exactly where the old file set it), and system.query_log per insert.
b Root cause explained? perf.py <settings> are file-level, so three block sizes needed three files. Query-level SETTINGS of INSERT ... SELECT reach the same query context, so one file can carry all three.
c Fix matches root cause? One file, per-INSERT settings, one table set per size, the s/m async_insert = 0 kept per query and the l queries on their default route.
d Test intent preserved / new tests added? Same nine inserts, parts, files, rows, settings and insert route. No test of the test infrastructure; validated locally.
e Both directions demonstrated? The query check reddens when async_insert = 0 is removed from an s query or added to an l query. Old and new files measured in the same windows, 6 reps.
f Fix is general across code paths? All three engines (Wide, Compact, Buffer) x three sizes checked insert by insert.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (no input surface). Each size's block size and row count checked.
h Backward compatible? (maintainer-approved exception only) No setting or product code changes. The test name changes, so the merged test starts without perf history.
i Invariants and contracts preserved? Per insert: same parts (InsertedWideParts / InsertedCompactParts / FileOpen / written_rows on every row), same Settings[...], same synchronous-insert reason; per size: own tables, so the same table history. max_insert_threads = 1 kept.

Session id: cron:clickhouse-impl-slot-5:20261104-191400

@groeneai

groeneai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

cc @Algunenano, could you review this and add the can be tested label so CI runs? It merges polymorphic_parts_{s,m,l} into one file (item 3 of #129258): the block sizes move into each INSERT's SETTINGS, each size keeps its own tables and insert route, and a local A/A run gave the same parts, files and rows per insert.

@egor-click

Copy link
Copy Markdown
Contributor

we have only test and query number for historical results, if we start deleting tests, all query numbers will change and all history we have will be thrown into trash

i don’t like that, @groeneai , this is a solution made in a hurry that will break more than it will improve

i think that we need a way to mark queries disabled,stale so they don't run and only append new queries or create new tests and never change or delete

@groeneai

groeneai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Understood. This PR renumbers no query in a surviving test: the 9 queries move to the new test name polymorphic_parts, so their history starts a new series and the three old series stop. I won't push to this PR or open more in the series until you and @ Algunenano agree on the approach. A disabled marker looks small in perf.py: the query number is the position in the expanded query list, so a disabled <query> that keeps its slot but is not run leaves every other number unchanged. I can send it as a separate PR if you want it.

@clickhouse-gh clickhouse-gh Bot added comp-testing Test content only (no production code). can be tested Allows running workflows for external contributors labels Nov 5, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d4a86f2]

Summary: ✅


AI Review

Summary

PR #129457 consolidates the three polymorphic_parts benchmarks into one file, preserving nine workloads with per-query insert settings and separate tables per size. Reviewed head d4a86f2480aea47ca3410b14dafd6859486c9b1b, the complete diff, current callers, and all prior discussion. No actionable findings remain; the documented history reset and measurement-noise tradeoffs do not warrant additional inline comments.

Missing context / blind spots
  • ⚠️ Performance CI jobs for this head were skipped. Independent validation here was static: all nine queries, effective settings, table definitions, cleanup, and Iceberg exclusion matched the originals. Timing and noise assessment relies on the six-repetition local A/A measurements reported in the PR description; a completed performance CI run would provide independent runtime confirmation.
Final Verdict

✅ Approve. No new inline findings.

@groeneai

groeneai commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@egor-click With the disabled approach this merge no longer saves anything, so I'd close it. These tests have no fill (the nine inserts are the measured work), so the only saving was the two perf.py processes it removed, about 1.5 s per arch and commit. If the three old files stay with their queries disabled, each still runs as its own perf.py process (connect, settings, SYSTEM STOP MERGES and the wait for running merges, sync), so the merged file would only add a fourth and restart the history of its nine queries. Close it, or do you want it in that form anyway?

@egor-click egor-click closed this Nov 5, 2026
@egor-click

Copy link
Copy Markdown
Contributor

closing it then, skip is the better approach for now, we can revisit when i can build better unique identifiers

@clickhouse-gh clickhouse-gh Bot added comp-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants