Skip to content

Give the array_join String benchmark a sink so it measures replication, not its result transfer - #119215

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-array-join-string-replicate-sink
Sep 12, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-array-join-string-replicate-sink

Conversation

@groeneai

@groeneai groeneai commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

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

Performance test array_join query 6 no longer returns its 45M-row result to the client, so it measures the String replication it was written for instead of the transfer.

Description

Performance Comparison (amd_release, master_head, 6/6) went red because array_join query 6 hit
perf.py's 15 s per-run cap (Code: 159, elapsed 15047 ms) and the raise ended the whole test file, so
the other six queries went unmeasured too. Failing report:
https://s3.amazonaws.com/clickhouse-test-reports/PRs/117841/cd367912710f933989029b2e7e808bdff049209c/pr/performance_comparison_amd_release_master_head_6_6/report.html

That query has no sink, alone in the file, so it ships all 45,000,000 result rows to the client: 540 MB
on the wire, and 95.9% of the failing run in NetworkSendElapsedMicroseconds. Its amd p50 is 7090 ms
against 47-275 ms for queries 0-5, past report.py's 2 s flag on every run, and
scripts/README.md:64-66 names the class ("a forgotten format Null").

I appended two settings to that one query and changed nothing else. Measured on the master
amd_release binary at the perf job's configuration (max_threads=8, 8 pinned cores), on a rig within
11% of the shard's CIDB p50:

  • format Null removes the transfer: 540 MB on the wire becomes 81 bytes, 6.479 s becomes 0.092 s.
  • enable_lazy_columns_replication = 0 keeps the benchmark on its subject. This is the arrayJoin
    function form and query_plan_lower_array_join_function is off by default, so the expansion runs in
    ExpressionActions, which wraps the String passenger in a lazy ColumnReplicated: the pin moves
    ColumnString::replicate from 12.5% to 63% of sampled frames. Precedent:
    array_join_filter_fusion.xml:26.

Through perf.py the file's run stage drops from 53.5 s to 8.4 s, all seven queries measured. The
default lazy path keeps its coverage in lazy_columns_replication,
array_join_lazy_replication_serialized_plan, lambda_captures_lazy_replication,
lazy_replicated_array_functions and array_join_filter_fusion. Query 6's measurement changes
meaning, so its per-query history is incomparable across this commit.

If both paths should stay covered here, I will parameterize the setting over 0/1 as
lambda_captures_lazy_replication.xml does rather than pin one arm.

Not fixed here: the harness itself still lets one over-budget query end its test file.


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

Version info

  • Merged into: 26.9.1.1259 (included in 26.9 and later)

tests/performance/array_join.xml query 6 has no sink, alone among the seven
queries of that file, so it returns all 45,000,000 result rows to the client:
540 MB on the wire, and 94-97% of its wall clock blocked in network send
(UserTimeMicroseconds 0.51 s of a 6.42 s run). That transfer is what its
7090 ms amd p50 measures, against 47-275 ms for queries 0-5 in the same file,
a documented ideal of 0.1-1 s and report.py's 2 s flag. Its tail also crosses
perf.py's 15 s per-run cap, and the resulting Code 159 ends the whole test file,
leaving the other six queries unmeasured. tests/performance/scripts/README.md:64-66
names the class, "a forgotten format Null".

Two settings are appended to that one query, nothing else changes:

  format Null discards the result, so 540,088,942 bytes on the wire become 81
  and the query goes from 6.479 s to 0.092 s.

  enable_lazy_columns_replication = 0 keeps the benchmark on its subject. The
  query uses the arrayJoin function form and query_plan_lower_array_join_function
  is off by default, so the expansion runs in ExpressionActions, which wraps the
  String passenger in a lazy ColumnReplicated; without the pin only 12.5% of the
  run is spent in ColumnString::replicate (562 of 4752 sampled frames), with it
  63% (2478 of 6100). array_join_filter_fusion.xml:26 pins the same setting for
  the same reason, and the lazy path keeps its own coverage in five other perf
  tests.

Measured with the master amd_release binary at the perf job's own configuration
(max_threads=8, 8 pinned physical cores, the perf users profile), a rig whose
medians sit within 11% of the shard's CIDB p50 on all seven queries of the file.
Through perf.py the file's run stage drops from 53.5 s to 8.4 s with all 7
queries measured. numbers(10000000), the projection and the expansion are
untouched, so the replicated volume is what it has been since 2024. Query 6's
measurement changes meaning, so its per-query history is incomparable across
this commit.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 10, 2026
@groeneai

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

Independent pre-publication review (engine: codex, 1 finding) plus my own cold pass (4 findings). No blocker.

# Sev Finding Verdict Evidence / action
1 ⚠️ At 0.092 s the fixed query is under the 0.1 s minimum documented in tests/performance/scripts/README.md:67-70, so it may be too noisy to read, and current-run proof is owed that it still measures eager String replication DISAGREE That table is no longer generated: ci/jobs/scripts/perf/report.py keeps only orphan CSS for it at :89-91. Short queries are in fact the most stable class in this harness: CIDB Performance Comparison (amd_release, master_head%, 21 days, 4.24M per-query rows, unstable on 0.15% of rows at 20-100 ms against 0.40% above 1 s, and array_join_lazy_replication_serialized_plan #0 runs at 11 ms with 700/700 success. The fixed query's measured spread is 1.30% over 7 client runs and 1.73% over 7 runs through perf.py, against the harness's own unstable bar of a >20% statistical threshold. Still-measuring proof: InterfaceNativeSendBytes 81 bytes per run, read_rows unchanged at 10,000,000, DB::ColumnString::replicate 40.6% of sampled frames with the pin against 11.8% without it, and 7/7 queries measured in three end-to-end perf.py runs.
2 💡 Three wording asks: name the tests that keep the default lazy path covered, offer the parameterized 0/1 alternative, and do not quote the calibration-scaled 0.109 s as if it were observed on CI AGREE all three are in the description above; the added comment stays at two lines because neither states anything obvious from the query text

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

If query 6 does come back unstable on this PR's own perf shards, the remedy is more volume, not a wider threshold.

Session id: cron:clickhouse-review-slot-9:20260910-113200

@clickhouse-gh clickhouse-gh Bot closed this Sep 10, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @yariks5s, could you review this? array_join query 6 was the only query in that file without a sink, so 94-97% of its 7 s median was the 540 MB result transfer to the client, and its tail crossed perf.py's 15 s per-run cap and ended the whole test file. format Null removes the transfer and enable_lazy_columns_replication = 0 puts the measurement back on ColumnString::replicate (12.5% to 63% of the run), following array_join_filter_fusion.xml:26.

@clickhouse-gh

clickhouse-gh Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4d00734]

Summary: ✅


AI Review

Summary

This PR turns the last unsinked query in tests/performance/array_join.xml into a normal performance benchmark by adding FORMAT Null, and it pins enable_lazy_columns_replication = 0 so the query still measures eager String replication instead of client result transfer. I do not see a correctness or coverage regression in the current patch: FORMAT Null still executes the full query, the eager-replication path is exactly the one gated in ExpressionActions, and the default lazy path remains covered by dedicated performance tests.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Sep 10, 2026
@alexey-milovidov alexey-milovidov self-assigned this Sep 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 12, 2026
Merged via the queue into ClickHouse:master with commit 382315b Sep 12, 2026
174 of 344 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 12, 2026
@clickhouse-gh clickhouse-gh Bot added comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. 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-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect 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