-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
raft-engine: reduce the threshold of compression and add related metrics on it. #16906
raft-engine: reduce the threshold of compression and add related metrics on it. #16906
Conversation
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Skipping CI for Draft Pull Request. |
/test all |
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
/retest-required |
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
src/config/mod.rs
Outdated
// better performance and reduce the IO overhead. | ||
// Meanwhile, the batch_compression_threshold cannot be modified dynamically if | ||
// the threads count of async-io are changed manually. | ||
self.mut_config().batch_compression_threshold = RaftEngineReadableSize(std::cmp::max( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does this means explicitly set config will also be changed? E.g, if user set the batch-compression-threshold
to 16kb, it will be optimized to 8kb, is this expected behavior?
I still think we better make the logic straight and only do adjust if it is the default config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
IMO, it's expected. As more async-io threads are set, smaller the batch of raft logs will be, the batch-compression-threshold
should be adaptive to the size of async-io
threads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a log if the config value is changed after optimization as it may surprise users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not only set it when it isn't specified explicitly in config. 4kb
may not be better for all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, how about introducing a flag raft_engine.customed
, which will be true if the user manually set raft-engine.batch-compression-ratio
with a specific value ?
And it can be combined with the current implementation that the batch-compression-threshold
will be adaptive to the size of async-ios if the user does not set it on purpose.
As for 4kb
, it's used to keep coincident with the minimal page size by default.
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
src/config/mod.rs
Outdated
// better performance and reduce the IO overhead. | ||
// Meanwhile, the batch_compression_threshold cannot be modified dynamically if | ||
// the threads count of async-io are changed manually. | ||
if !self.customized && raft_store.store_io_pool_size > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make batch_compression_threshold
as Option<..>
, then you can know whether it's sepecified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not appropriate.
make batch_compression_threshold as Option<..>, then you can know whether it's sepecified
If so, we cannot know whether the user forcely disable compression feature in RaftEngine, as the None
is used as the default value for batch_compression_threshold
. Moreover, RaftEngine also needs a default value with Some(8kb)
and it is not compatible to this proposal.
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
@LykxSassinator: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
@LykxSassinator: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/merge |
@LykxSassinator: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: fd36279
|
In response to a cherrypick label: new pull request created to branch |
ref tikv#16907 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
…ics on it. (#16906) (#16967) ref #16907 This pr contains: - Reduce the default compression threshold in RaftEngine to `4kb` as default if users do not manually set it. - Add relevant metrics on the compression ratio of RaftEngine.write. Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Signed-off-by: lucasliang <nkcs_lykx@hotmail.com> Co-authored-by: lucasliang <nkcs_lykx@hotmail.com>
What is changed and how it works?
Issue Number: Ref #16907 ref tikv/raft-engine#358
What's Changed:
The relevant metrics will be shown just like the following shows:
![image](https://private-user-images.githubusercontent.com/18441614/324785297-4a6f6db0-1602-4a7a-9a42-552231633c9e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxNzEwOTgsIm5iZiI6MTcyMDE3MDc5OCwicGF0aCI6Ii8xODQ0MTYxNC8zMjQ3ODUyOTctNGE2ZjZkYjAtMTYwMi00YTdhLTlhNDItNTUyMjMxNjMzYzllLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA1VDA5MTMxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5NTlhZGQzYmUxODgxMTBmM2Q2MDk0ZmI0OThkM2NjOGJmNmQ3NzcyZmNjMWYyZTZlNjZjNmE0M2VlYzkyZGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hDnBc0CyFOyYkSAS3p3yhYpztqHX4DvGmeRNHj8-6bA)
And as for performance, taking
![image](https://private-user-images.githubusercontent.com/18441614/325462474-58e7ec94-c62a-4a04-8ec5-9f0487cd8efc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxNzEwOTgsIm5iZiI6MTcyMDE3MDc5OCwicGF0aCI6Ii8xODQ0MTYxNC8zMjU0NjI0NzQtNThlN2VjOTQtYzYyYS00YTA0LThlYzUtOWYwNDg3Y2Q4ZWZjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA1VDA5MTMxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1YTIzYjE0Y2Q3ZWYzNTBlNWRmNzQzN2MzYTQxMThjMjdiYjgwOGE2ZmUyNmNlODU4OTVmMDZmOWJkOGY5NzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sxfktRapKBVbknAv1JlxEOSVQPqEHQIRItdfT4HtIJY)
tpcc
workloads, usingv7.5.x (disable async-io and compression-threshold = 8kb as default)
as the baseline, the CPU.utilization keeps nearly same in this pr.And using smaller compression threshold with
batch-compression-threshold = 4kb, async-io
, keeps the same, and the costs of IO Bandwidth are smaller thanv8.1.0-nightly ((batch-compression-threshold = 8kb, async-io)
. (PS: smaller is better in "Disk IO Throughputs")Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
Release note