Skip to content
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

kv-client: use multiple sync.Map to reduce lock contention #1439

Conversation

amyangfei
Copy link
Contributor

@amyangfei amyangfei commented Feb 22, 2021

What problem does this PR solve?

part 3 of #1393, please review this PR after #1426 is merged

What is changed and how it works?

  • Use multiple sync.Maps for regionFeedState get/put operation.
  • The bucket size of sync.Map pool is determined by cpu number, min threshold, and max threshold

Check List

Tests

  • Unit test
  • Integration test

Release note

  • No release note

@amyangfei amyangfei added status/WIP component/kv-client TiKV kv log client component. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. labels Feb 22, 2021
@amyangfei amyangfei added this to the v4.0.12 milestone Feb 22, 2021
@amyangfei
Copy link
Contributor Author

/run-all-tests

@amyangfei amyangfei force-pushed the kv-client-reduce-goroutine-map-optimization branch 2 times, most recently from 7035d36 to c9ec547 Compare February 22, 2021 13:57
@amyangfei
Copy link
Contributor Author

/run-all-tests

@amyangfei amyangfei force-pushed the kv-client-reduce-goroutine-map-optimization branch from c9ec547 to c6fb15e Compare February 26, 2021 08:22
@amyangfei amyangfei added status/ptal Could you please take a look? and removed status/WIP labels Feb 26, 2021
@amyangfei
Copy link
Contributor Author

/run-integration-tests


var wg sync.WaitGroup
wg.Add(2)
go func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please add more goroutine to make sure the thread-safety?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed

@amyangfei
Copy link
Contributor Author

PTAL @leoppro @liuzix

@zier-one
Copy link
Contributor

zier-one commented Mar 2, 2021

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 2, 2021
@liuzix
Copy link
Contributor

liuzix commented Mar 2, 2021

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 2, 2021
@amyangfei
Copy link
Contributor Author

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 2, 2021
@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 1467

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@amyangfei merge failed.

@amyangfei
Copy link
Contributor Author

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@amyangfei
Copy link
Contributor Author

/run-kafka-tests

@ti-srebot ti-srebot merged commit 355016c into pingcap:master Mar 2, 2021
ti-srebot pushed a commit to ti-srebot/ticdc that referenced this pull request Mar 2, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #1476

ti-srebot added a commit that referenced this pull request Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/kv-client TiKV kv log client component. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. status/ptal Could you please take a look?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants