Skip to content

Write the number_formatting_formats perf test output to /dev/null - #127695

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-number-formatting-formats-dev-null
Oct 25, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-number-formatting-formats-dev-null

Conversation

@groeneai

@groeneai groeneai commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #100759

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

The number_formatting_formats performance test writes the output of queries #0-#11 to /dev/null, so these queries time the formatting instead of the runner's disk.

Description

number_formatting_formats is the noisiest test in the #100759 report: on master from 2026-10-22 to 10-24, 344 of 2240 query-runs were over the report's floors, 29-45% for #0, #1, #2, #6 and #7. Example: arm_release 5/6, #0 unstable.

Queries #0-#11 insert 10M numbers into File(<format>) with engine_file_truncate_on_insert = 1, so every measured run truncates and rewrites the same 30-349 MB file on the runner's disk. In query_metric_runs_v1, per-run time correlates with OSIOWaitMicroseconds at 0.94-0.999, while the coefficient of variation of CPU time is 3-8%. The first measured run is up to 3x faster than the later ones (#1, amd: 0.096, 0.302, 0.303, 0.298, 0.298 s, with 0.12 s of CPU time and 79 MB written in every run).

This writes them to File(<format>, '/dev/null'), like select_format, writing_valid_utf8 and formats_hits_write do, and drops the truncate setting, which does nothing on /dev/null. The formatting and the File sink are unchanged. The measured runs no longer copy the output into the page cache or wait for the disk. The new query texts also reset the learned thresholds of #0-#11, which were built from that noise (max_stat_threshold up to 2.31). #12/#13 append without truncating, are stable and stay unchanged. Their table is File(TabSeparated) because its create query uses {format}.

Validation: I ran perf.py with the official master release build, both servers pinned to 8 cores with max_threads = 8 and data on EBS. Old test: 6 and 9 of 24 per-server series of #0-#11 start fast (first run below 0.85 of the median) in 2 runs. New test: 0 of 72 in 3 runs. OSWriteBytes is 0 in every new run, compared with the full output size in every old run. No query is over the floors in more than one of the 3 runs. #0-#8 now take 20-55 ms.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.745-master (included in 26.11 and later)

Queries #0-ClickHouse#11 truncated and rewrote a 30-349 MB file on the runner's
disk in every measured run. On master CI their per-run client time
correlates with OSIOWaitMicroseconds at 0.94-0.999 and not with CPU
time, and the first measured runs are up to 3x faster than the later
ones, so the queries timed the disk instead of the formatting.

Use a File table on '/dev/null', like select_format, writing_valid_utf8
and formats_hits_write: the same formatting and File sink run, nothing
is written to the page cache. engine_file_truncate_on_insert is a no-op
on '/dev/null', and dropping it also gives the queries new display
names, so they no longer inherit the learned thresholds of the old
disk-bound queries.

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

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

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

# Sev Finding Verdict Evidence / action
1 💡 The description must say the measured runs also lose the page-cache copy, not only the disk wait, and make no speed claim AGREE Stated in the description; no code change

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. With the old test on two perf.py servers (master release build, pinned to 8 cores, max_threads = 8, data on EBS), #0's first measured run is 0.11-0.30 of the median on both servers in both runs (4 of 4 series), and so is #9's on both servers and #10's on one.
b Root cause explained? #0-#11 truncate and rewrite the same 30-349 MB file on every measured run, so a run's time depends on how much of the earlier runs' disk work is still pending. In master CI, per-run time correlates with OSIOWaitMicroseconds at 0.94-0.999 and CPU time is flat.
c Fix matches root cause? Yes. The output goes to /dev/null, the sink StorageFile allows for perf tests, so no run writes to the disk. No product change and no fast path: the same format and File sink still run.
d Test intent preserved / new tests added? The test still times formatting 10M UInt64 values into each of the 12 formats through the File sink (OSWriteChars matches the CI bytes). The page-cache copy and the disk wait are no longer timed. This is a perf test change, so it ships local before/after evidence and no new test.
e Both directions demonstrated? Old: 6 and 9 of 24 per-server series start fast in the two pinned runs, and OSWriteBytes is the full output size in every run. New: 0 of 72 in 3 runs, and OSWriteBytes is 0.
f Fix is general across code paths? All 12 truncating queries share one create query and one query template, so they are fixed together, and the prewarm uses the same table. #12/#13 append, are stable and are untouched. The other perf tests with a timed truncating INSERT to disk are not noisy (at most 4% over the floors).
g Fix generalizes across inputs (params/datatypes/wrappers)? All 12 formats, including Parquet, ODBCDriver2, MySQLWire and XML, insert into /dev/null repeatedly on both servers without an exception. CI shows the same root cause on amd and arm.
h Backward compatible? (maintainer-approved exception only) Test only, with no setting or format change. #0-#11 get new display names, so their learned thresholds, which were built from the disk noise, reset to the default floors.
i Invariants and contracts preserved? Query indices 0..13 are unchanged and in the same order (perf.py --print-queries). #12/#13 and the substitutions are byte-identical. DROP TABLE leaves /dev/null a character device.

Session id: cron:clickhouse-impl-slot-6:20261024-064500

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @egor-click, could you review this and add the can be tested label so CI runs? Queries #0-#11 truncated and rewrote a 30-349 MB file on the runner disk every run, so their time followed the disk write-back (per-run time correlates with OSIOWaitMicroseconds at 0.94-0.999) and the first run was up to 3x faster; they now write to /dev/null like select_format does, with the same formats and File sink.

@clickhouse-gh

clickhouse-gh Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bfc2afe]

Summary: ✅


AI Review

Summary

The change directs queries #0–#11 in number_formatting_formats to /dev/null and removes engine_file_truncate_on_insert, preserving their formatting work while eliminating disk writes. The reported local before/after perf.py measurements support the intended reduction in timing variance. Performance CI was skipped; benchmarks were not rerun during this review. No actionable findings.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 24, 2026
@egor-click egor-click added the can be tested Allows running workflows for external contributors label Oct 24, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 24, 2026
@Algunenano Algunenano self-assigned this Oct 24, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 25, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 25, 2026
Merged via the queue into ClickHouse:master with commit ab3de7d Oct 25, 2026
352 of 353 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 25, 2026
@clickhouse-gh clickhouse-gh Bot added comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). 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-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). 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.

5 participants