Skip to content

server: check raft_client config change after flush#12781

Merged
ti-chi-bot merged 9 commits intotikv:masterfrom
glorv:opt-buffer-push
Jun 10, 2022
Merged

server: check raft_client config change after flush#12781
ti-chi-bot merged 9 commits intotikv:masterfrom
glorv:opt-buffer-push

Conversation

@glorv
Copy link
Contributor

@glorv glorv commented Jun 8, 2022

Signed-off-by: glorv glorvs@163.com

What is changed and how it works?

Issue Number: Close #12780

What's Changed:

Move the online config change from `push` to `flush` for better performance.

Benchmark:
I use the bench_client_buffer_push to test this change. Because it's hard to mock the grpc connect in flush, I use the clear method to mock flush that only clean the buffer and check config change. This bench doesn't do config change simultaneously as the config change is rural.

I run each bench for 10 times and choose the middle result, the middle result is almost equal to the avg result.
before:

running 1 test
test server::raft_client::tests::bench_buffer_push       ... bench:       2,171 ns/iter (+/- 762)

after:

running 1 test
test server::raft_client::tests::bench_buffer_push       ... bench:       2,102 ns/iter (+/- 514)

The bench result shows there is about 3% performance improvement. In theory, the cost of an atomic load is less than 10ns, so the theoretical extra cost of the check is about 5%. Thus, the bench result matches the expectation.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

  • Performance regression

Release note

None

glorv added 2 commits June 8, 2022 14:21
Signed-off-by: glorv <glorvs@163.com>
Signed-off-by: glorv <glorvs@163.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jun 8, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • BusyJay
  • zhangjinpeng1987

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Details

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jun 8, 2022
@glorv glorv requested a review from BusyJay June 8, 2022 06:37
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 8, 2022
@glorv glorv changed the title check config change after flush server: check raft_client config change after flush Jun 8, 2022
}

#[bench]
fn bench_client_buffer_push(b: &mut test::Bencher) {
Copy link
Member

Choose a reason for hiding this comment

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

Better to move into tests/benches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are bench cases both in the tests/benches and in the tests section of normal src files, is there any style guide about this?

Copy link
Member

Choose a reason for hiding this comment

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

benches dir first.

Copy link
Member

@zhangjinpeng87 zhangjinpeng87 left a comment

Choose a reason for hiding this comment

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

rest LGTM

glorv added 4 commits June 8, 2022 16:51
Signed-off-by: glorv <glorvs@163.com>
Signed-off-by: glorv <glorvs@163.com>
Signed-off-by: glorv <glorvs@163.com>
Copy link
Member

@zhangjinpeng87 zhangjinpeng87 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 9, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 9, 2022
@zhangjinpeng87
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@zhangjinpeng1987: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Details

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.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

DetailsCommit hash: 2e23288

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 10, 2022
@ti-chi-bot
Copy link
Member

@glorv: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Details

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.

@ti-chi-bot ti-chi-bot merged commit 050b6c0 into tikv:master Jun 10, 2022
BusyJay added a commit to BusyJay/tikv that referenced this pull request Aug 11, 2022
…)"

This reverts commit 050b6c0.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
BusyJay added a commit to BusyJay/tikv that referenced this pull request Aug 11, 2022
…ikv#12781)""

This reverts commit 0c20664.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
@glorv glorv deleted the opt-buffer-push branch October 20, 2022 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize the config change check in raft_client MessageBuffer

4 participants