Skip to content

Add ability to throttle merges/mutations#57877

Merged
serxa merged 4 commits intoClickHouse:masterfrom
azat:merges-mutations-throttling
Jan 5, 2024
Merged

Add ability to throttle merges/mutations#57877
serxa merged 4 commits intoClickHouse:masterfrom
azat:merges-mutations-throttling

Conversation

@azat
Copy link
Copy Markdown
Member

@azat azat commented Dec 14, 2023

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Add ability to throttle merges/mutations (max_mutations_bandwidth_for_server/max_merges_bandwidth_for_server)

Main motivation was to has an ability to throttle background tasks, to
avoid affecting queries.

To new server settings had been added for this:

  • max_mutations_bandwidth_for_server
  • max_merges_bandwidth_for_server

Note, that they limit only reading, since usually you will not write
more data then you read, but sometimes it is possible in case of ALTER
UPDATE.

But for now, to keep things simple, I decided to limit this with only
2 settings instead of 4.

Note, that if the write throttling will be needed, then they can use the
same settings, and just create new throttler for write.

@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-improvement Pull request with some product improvements label Dec 14, 2023
@robot-ch-test-poll4
Copy link
Copy Markdown
Contributor

robot-ch-test-poll4 commented Dec 14, 2023

This is an automated comment for commit 837f4ea with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker image for serversThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integrational tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool✅ success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style CheckRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR⏳ pending
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts❌ failure

@azat azat force-pushed the merges-mutations-throttling branch from 738f20e to 237c2a0 Compare December 14, 2023 19:48
@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 18, 2023

Stateless tests (debug, s3 storage) [5/6] — fail: 2, passed: 986, skipped: 23

azat added 4 commits December 24, 2023 22:29
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Main motivation was to has an ability to throttle background tasks, to
avoid affecting queries.

To new server settings had been added for this:
- max_mutations_bandwidth_for_server
- max_merges_bandwidth_for_server

Note, that they limit only reading, since usually you will not write
more data then you read, but sometimes it is possible in case of ALTER
UPDATE.

But for now, to keep things simple, I decided to limit this with only
2 settings instead of 4.

Note, that if the write throttling will be needed, then they can use the
same settings, and just create new throttler for write.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 24, 2023

Can someone take a look please? (In the mean time I will fix conflicts)

@azat azat force-pushed the merges-mutations-throttling branch from 237c2a0 to 837f4ea Compare December 24, 2023 21:45
@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 27, 2023

CI failures is unrelated:

Upgrade check (msan) — check_status.tsv doesn't exists

2023.12.25 00:56:02.925970 [ 187827 ] {} <Error> Application: Caught exception while loading metadata: Code: 695. DB::Exception: Load job 'load table test_3.testCleanupR1' failed: Code: 36. DB::Exception: Wrong number of engine arguments.: Cannot attach table `test_3`.`testCleanupR1` from metadata file /var/lib/clickhouse/store/fcf/fcf5a2b4-8900-4a4d-a223-f2a4c28c28d8/testCleanupR1.sql from query ATTACH TABLE test_3.testCleanupR1 UUID 'b24abdb6-5810-462c-9504-f92d80251cb1' (`uid` String, `version` UInt32, `is_deleted` UInt8) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/test_3/tables/test_cleanup/', 'r1', version, is_deleted) ORDER BY uid SETTINGS enable_vertical_merge_algorithm = 1, vertical_merge_algorithm_min_rows_to_activate = 0, vertical_merge_algorithm_min_columns_to_activate = 0, min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, index_granularity = 41917, ratio_of_defaults_for_sparse_serialization = 1., replace_long_file_name_to_hash = 1, max_file_name_length = 56, merge_max_block_size = 14489, prefer_fetch_merged_part_size_threshold = 10737418240, min_merge_bytes_to_use_direct_io = 1, index_granularity_bytes = 16945590, allow_vertical_merges_from_compact_to_wide_parts = 1, marks_compress_block_size = 88601, primary_key_compress_block_size = 16356. (BAD_ARGUMENTS), Stack trace (when copying this message, always include the lines below):

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 28, 2023

Kind ping

@azat
Copy link
Copy Markdown
Member Author

azat commented Jan 1, 2024

@serxa maybe you can take a look?

@serxa serxa self-assigned this Jan 4, 2024
@serxa
Copy link
Copy Markdown
Member

serxa commented Jan 4, 2024

Thanks for pointing, I completely missed when this PR was created

@serxa serxa merged commit 8d6b012 into ClickHouse:master Jan 5, 2024
@azat azat deleted the merges-mutations-throttling branch January 5, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants