-
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
raftstore: optimize the batching mechanism when enabling async-ios. #17029
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: lucasliang <[email protected]>
[REVIEW NOTIFICATION] This pull request has not been approved. 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. |
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: lucasliang <[email protected]>
…l of spin. Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
/test |
@LykxSassinator: The
Use 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 kubernetes/test-infra repository. |
/test pull-unit-test |
Signed-off-by: lucasliang <[email protected]>
An intuitive idea: What about move write task batch to raft fsm side. Instead of send a write message after handle each region, we can first cache region write message at the PollCtx, and after handle several regions, when the total write msg size exceeds a certain threshold or the current poll round is over, then we send the cached write tasks to the write thread. It seems more easier to handle this batch logic at the raft fsm side than the write io thread side. |
/// If the batch size is smaller than the threshold, it will return a | ||
/// recommended yield duration for the caller as a hint to wait for more writes. | ||
/// The yield interval is calculated based on the trend of the change of the | ||
/// batch size. The range of the trend is [0.5, 2.0]. If the batch size is |
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.
Can you explain what does 2.0 mean and what does 0.5 mean? What is the quantitive relationship with wait time?
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.
Just a heuristic ratio according to testing records, reflecting that the time of yield
ranges from [yield_time
* 0.5, yield_time
* 2.0] nanoseconds. By default, the yield_time is 50 nanoseconds
. So, the ranges of the whole yielding is [25 nanoseconds, 100 nanoseconds]
.
Looks promising, it's just how sync does that batch the writes in one poll. Maybe you can make a quick poc. |
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
@LykxSassinator @glorv This is a good idea. I think we can merge current solution first because it is well tested and has promising benefits of reducing IOPS and IO bandwidth, and then evaluate the new idea. What do you think? |
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 <[email protected]>
Based on the most recent performance comparisons with version 8.1.0 (default LTS version), Most typical workloads have passed the testing standards. However, it appears that the larger batch flushing introduced by this PR may lead to performance regressions in the Therefore, this PR will be put on hold until a more suitable configuration for optimizing the WriteBatch size is identified. |
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
Signed-off-by: lucasliang <[email protected]>
What is changed and how it works?
Issue Number: Ref #16907
What's Changed:
Previously, ##16906 had already lowered the compression threshold to alleviate the strain on IO resources. However, it was found that this configuration adjustment had limited impact on reducing IO resource costs.
Therefore, this PR introduces a simple algorithm (using sliding window) to track the real-time size of WriteBatch and initiate a yield operation if the WriteBatch size is under the desired threshold. This mechanism aims to increase the WriteBatch size as needed, a strategy that has proven effective in saving IO resources.
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
By testing on
oltp-read-write
workload:Side effects
Release note