Skip to content

Make the replace_string_fast_path performance test less noisy - #122571

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix/replace-string-fast-path-perf-noise
Oct 3, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix/replace-string-fast-path-perf-noise

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Each query of the replace_string_fast_path performance test processed only 5 million rows and finished in ~20 ms, so the comparison measured memory-bandwidth jitter rather than the code. Query #4 (FixedString verbatim copy) was flagged as a confirmed slowdown on master itself (2026-09-17) and on unrelated pull requests, and in the run below queries #2..#4 moved 11-17% together on a PR that does not touch replaceAll.

This PR raises the row count to 20 million, so each query takes ~100 ms.

Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=110613&sha=dbef7b1548eb9998ee9556d003008cd13d3bffee&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%204%2F6%29
Related: #110613
Related: #119839

Changelog category (leave one):

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

🤖 Generated with Claude Code


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

Version info

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

Each query copied only 5 million rows and finished in ~20 ms, so the
performance comparison measured memory-bandwidth jitter: query #4
(`FixedString` verbatim copy) was flagged as a confirmed slowdown on
`master` itself (2026-09-17) and on unrelated pull requests (#119839,
#110613), and queries #2..#4 moved 11-17% together in one run.
Process 20 million rows, so each query takes ~100 ms.

Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=110613&sha=dbef7b1548eb9998ee9556d003008cd13d3bffee&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%204%2F6%29
PR: #110613

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a25bf88]

Summary: ✅


AI Review

Summary

This PR raises the replace_string_fast_path benchmark from numbers_mt(5000000) to numbers_mt(20000000) so the queries spend enough time in the perf harness to stop measuring mostly short-query jitter. The scope is limited to a single CI-only performance test, the selected Changelog category matches that scope, and I do not see a correctness or maintenance issue in the updated test. The current PR discussion also notes that the updated replace_string_fast_path queries are stable within 3%, which is consistent with the intent of this change.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Sep 27, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: the Performance Comparison flagged map_contains_value_subcolumn #1 (+15.5%, https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122571&sha=c02ed54b14e9d5afdbd85426239f9bf994496d0e&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%203%2F6%29) and lazy_materialization_final_limit #1 (+17.8%, https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122571&sha=c02ed54b14e9d5afdbd85426239f9bf994496d0e&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%206%2F6%29) as confirmed regressions, although this PR only changes tests/performance/replace_string_fast_path.xml (whose queries are all stable now, within 3%). lazy_materialization_final_limit remains noisy even with #122479 already in this branch. Please provide a fix in a separate PR. If the fix is already in progress, link it here.

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Acknowledged. No fix is in progress for either query. I'm investigating map_contains_value_subcolumn #1 and the remaining lazy_materialization_final_limit #1 noise (#122479 already pins that test's part layout, so this is a different source). I'll follow up here with a PR (or my findings) shortly.

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

lazy_materialization_final_limit #1: since #122479 both servers read the same data, but #1 never reaches its LIMIT 100 (only 47 rows match after FINAL), so it lazily reads about 285 MB of incompressible payload for those rows, and on arm one server of a pair sometimes spends about 20% longer on that page-cache read. #123719 cuts the read to about 32 MB with 256-row granules.

map_contains_value_subcolumn #1: this was a per-process slow mode of the numeric has loop on arm (12% of server processes ran #1 more than 5% slower than their own #0, which reads the same column). It is gone since #119090 (merged 2026-10-01; 0.1% of 1276 processes since then), and the new head of this PR runs on a base that includes it, so I have no PR for it.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Oct 3, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 3, 2026
Merged via the queue into master with commit 04249b5 Oct 3, 2026
161 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/replace-string-fast-path-perf-noise branch October 3, 2026 17:21
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 3, 2026
jh0x pushed a commit to jh0x/ClickHouse that referenced this pull request Oct 5, 2026
…e test

Query #1 (`FINAL WHERE v = 7 LIMIT 100`) never reaches its limit: only 47 rows
survive FINAL, so it scans all of (k, v) and lazily reads `payload` for those
47 rows. With default granules (~5-6K rows of 2 KB random, incompressible
strings, ~10 MB each) every match decodes ~6 MB of payload, ~285 MB in total.

After ClickHouse#122479 both compared servers read identical data, but on arm one server
of a pair still copies those same bytes out of the page cache ~20% slower in a
few percent of fills, and with merges stopped all runs of the query carry it:
PR ClickHouse#122571 got a confirmed +17.8% on `Performance Comparison (arm_release,
master_head, 6/6)` this way.

With `index_granularity = 256` a granule is ~0.5 MB and one compressed block,
so each match reads ~0.5 MB. Measured on a two-server rig with the XML's own
statements: #1 ReadCompressedBytes 284.1 MB -> 31.8 MB, SelectedRows 1,015,104,
#0 and #2 read less too (58.7 -> 13.3 MB). The test still measures FINAL over
the same two intersecting parts with lazy materialization of the wide payload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-regular-function Regular scalar functions: string processing, data conversion, arithmetic, math, comparison, condi... 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

comp-regular-function Regular scalar functions: string processing, data conversion, arithmetic, math, comparison, condi... 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