Skip to content

Fix classification perf test regression from #106278 - #106384

Merged
alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
Algunenano:fix-classification-perf-regression
Jun 6, 2026
Merged

alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
Algunenano:fix-classification-perf-regression

Conversation

@Algunenano

@Algunenano Algunenano commented Jun 3, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #106278.

#106278 aimed to remove the LIMIT-without-ORDER BY non-determinism in the classification perf test by sampling with WHERE cityHash64(WatchID) % N = 0. Post-merge master data shows it did not work — it moved the sampling into the measured query, which forces a full table rescan on every run, so the queries got slower and noisier instead of more stable.

Master noise rate (default.checks, pull_request_number = 0, master_head), before vs after #106278 merged (2026-06-02 20:09 UTC):

query before after
classification #0 6.5% 76.2%
classification #1 10% 90.5%
classification #2 0% 0%
classification #3 2% 0%
classification #4 0% 0%

#2/#3/#4 were already clean, so the only net effect of #106278 was regressing #0/#1.

This change keeps the determinism but moves it into the setup, like #106249 did for reading_from_file: materialize the deterministic subset once in fill_query into its own single-part table (single-threaded insert + OPTIMIZE FINAL, so both servers get an identical part), and have the measured queries read only that subset instead of rescanning the source. detectTonality (#2) still reads the full table and is unchanged.

Related: #100759

Changelog category (leave one):

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

Version info

  • Merged into: 26.6.1.446

ClickHouse#106278 tried to remove the LIMIT-without-ORDER-BY non-determinism by
sampling with WHERE cityHash64(WatchID) % N = 0. Post-merge master data
showed it did not work: it made the measured queries scan the whole table on
every run, so instead of reducing the noise it regressed it badly:

  classification #0: 6.5% -> 76% noisy
  classification #1:  10% -> 90% noisy

(#2/ClickHouse#3/ClickHouse#4 were already clean.)

Materialize the deterministic subset once into its own single-part table
(single-threaded insert + OPTIMIZE FINAL) and measure over that, so the
determinism lives in the setup (like ClickHouse#106249 for reading_from_file) and the
measured queries read only the subset instead of rescanning the source.
@clickhouse-gh

clickhouse-gh Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4a72d7c]

Summary: ✅


AI Review

Summary

This PR changes tests/performance/classification.xml so the measured detectLanguage, detectLanguageMixed, detectLanguageUnknown, and detectCharset queries read deterministic materialized subsets instead of sampling hits_100m_single during every measured run. I did not find unresolved correctness or CI-test reliability issues. The earlier missing performance-evidence concern is addressed: the completed e738f80 performance comparison covers the same byte-identical XML as the current PR head and shows the classification rows within the reported thresholds.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 3, 2026
Comment thread tests/performance/classification.xml Resolved
@Algunenano Algunenano added ci-performance performance only and removed ci-performance performance only labels Jun 3, 2026
@Algunenano Algunenano self-assigned this Jun 3, 2026
@Algunenano
Algunenano marked this pull request as draft June 3, 2026 17:46
@Algunenano Algunenano removed the ci-performance performance only label Jun 4, 2026
@Algunenano
Algunenano marked this pull request as ready for review June 4, 2026 12:00
@Algunenano

Copy link
Copy Markdown
Member Author

Performance comparison ran on both amd_release and arm_release for this commit (3980c34), so we now have before/after data for this exact change.

Classification results (base master_head vs this PR, client_time):

query amd arm
#0 detectLanguage −6.6% (9.18→8.58s) −11.1% (2.05→1.83s)
#1 detectLanguageMixed −6.6% (9.02→8.43s) +12.1% (2.00→2.24s), unstable, threshold ±31.5%
#2 detectTonality −2.5% −0.2%
#3 detectLanguageUnknown −1.2% −0.5%
#4 detectCharset +0.6% −0.6%

Total across both arches: 0 slower, 0 faster, 1 unstable.

The query that motivated this PR — #1 detectLanguageMixed, which was ~90% noisy on amd master_head before — is now stable on amd (−6.6%, no flag), and all five queries are within noise on both arches. The single remaining flag is #1 on arm, reported unstable but within its threshold (+12.1% vs ±31.5%) and non-directional. That residual is detectLanguageMixed's own within-run variance on the now-deterministic materialized input, not the data-determinism/rescan problem this PR fixes.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 6, 2026
@alexey-milovidov alexey-milovidov self-assigned this Jun 6, 2026
@alexey-milovidov alexey-milovidov added the post-approved Approved, but after the PR is merged. label Jun 6, 2026
Merged via the queue into ClickHouse:master with commit ab83938 Jun 6, 2026
166 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 Jun 6, 2026
@Algunenano

Copy link
Copy Markdown
Member Author

Follow-up: post-merge data showed this materialized-subset approach still left classification #0/#1 as the noisiest tests in CI (~37-46%). The residual is the per-process placement asymmetry between the two perf servers, amplified by the memory-bound detect* functions (one server ~4.5x slower on identical binary/data — 4x CPU, 7x system time), which no test-level change fully removes. Since these NLP functions are rarely used, the test is being removed entirely in #106732.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

post-approved Approved, but after the PR is merged. 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