Skip to content

Reduce disk usage of performance tests - #111377

Merged
rienath merged 5 commits into
masterfrom
perf-tests-disk-usage
Jul 22, 2026
Merged

rienath merged 5 commits into
masterfrom
perf-tests-disk-usage

Conversation

@rienath

@rienath rienath commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Performance tests started failing with out-of-disk errors [1, 2, 3]. This PR adds a clean up of files created during performance tests by INSERT INTO FUNCTION file(...). Previously, they used to accumulate until the end of the job.

It also decreases table sizes of really heavy tests:

  • min_max_index: 429M -> 107M rows, disk 15.2 GB -> 3.0 GB.
  • join_convert_to_fixed_hash_table: 200M -> 50M rows, disk 27.4 GB -> 6.1 GB.

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

...

Version info

  • Merged into: 26.7.1.1337 (included in 26.7 and later)

@clickhouse-gh

clickhouse-gh Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e9f7b3c]

Summary: ✅


AI Review

Summary

This PR tries to reduce performance-test disk usage by cleaning user_files after each XML test and by shrinking two especially heavy benchmarks. The benchmark-size reductions look fine, but the new cleanup hook is attached too late in the execution model: perf.py runs all selected queries for a test before returning, so a write benchmark can still keep appending into user_files until the disk fills up before the new cleanup ever runs.

Findings

⚠️ Majors

[ci/jobs/performance_tests.py:1394] cleanup_user_files only runs after CHServer.run_test returns. tests/performance/scripts/perf.py executes create/fill once, then prewarms and repeatedly re-runs each sampled query before it exits, and tests/performance/file_table_function.xml still appends timed INSERT INTO FUNCTION file('test_file', ...) results into the same path without truncation. Because of that, one test can still grow user_files/test_file for the prewarm plus roughly seven measured runs of up to ten sampled queries before this cleanup fires, so peak disk usage is still unbounded within a single test and the ENOSPC failure can still happen before line 1394 is reached.

Suggested fix: reset user_files inside the per-query execution path in tests/performance/scripts/perf.py, or keep an explicit truncation/reset on benchmarks that repeatedly write to the same file() path.

Final Verdict

Status: ⚠️ Request changes

Minimum required actions:

  1. Bound user_files growth within a single performance test, not only between XML files.
  2. Re-run the affected performance job and confirm the file() write benchmark no longer reproduces the out-of-disk failure.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 22, 2026
print(f"Test Files ({len(test_files)}): [{test_files}]")
assert test_files

def cleanup_user_files():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cleanup_user_files() only runs after CHServer.run_test returns, but run_test delegates to tests/performance/scripts/perf.py, and that harness executes the whole XML test in one shot: create/fill, then prewarm, then repeated measured runs for every sampled query, and only then exits.

That means this cleanup never bounds peak usage within one test. tests/performance/file_table_function.xml still reuses the same file('test_file', ...) path for timed inserts without truncation, so the prewarm plus roughly seven measured runs of up to ten sampled queries can keep appending into user_files/test_file until the disk fills up before line 1394 is ever reached. Can we move the reset into the per-query path (or otherwise truncate/reset benchmarks that repeatedly write to the same file() path) so the fix actually caps peak disk usage instead of only cleaning end-of-test leftovers?

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.

Correct that this doesn't bound the peak within one test – that's intentional. The observed failures were caused by accumulation across tests, not a single huge test.

Truncating inside measured query adds a huge speed overhead and we don't see what we are measuring anymore. Better avoided

@thevar1able thevar1able self-assigned this Jul 22, 2026
@rienath
rienath added this pull request to the merge queue Jul 22, 2026
Merged via the queue into master with commit 8837bba Jul 22, 2026
179 checks passed
@rienath
rienath deleted the perf-tests-disk-usage branch July 22, 2026 15:05
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 22, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…usage

Reduce disk usage of performance tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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