-
Notifications
You must be signed in to change notification settings - Fork 289
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
ticdc/kvclient: make multiple cdc kv clients share one RegionCache #3464
Conversation
[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. |
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
cdc/kv/region_cache.go
Outdated
regionCacheOnce.Do(func() { | ||
regionCacheInstance = tikv.NewRegionCache(pd) | ||
}) |
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.
kv client would close region cache after it exits, which is not expected after using a singleton
Besides please check whether any side effect was introduced to existing unit tests |
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
/run-all-tests |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 197d005
|
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created: #3633. |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created: #3634. |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created: #3635. |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created: #3636. |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created: #3637. |
What problem does this PR solve?
issue 3208
Considering the following test:
sysbench prepare
command.Optimization Result:
Before optimization: In
go pprof goroutine
result, we can see 10 goroutines associated with*RegionCache).asyncCheckAndResolveLoop
.After optimization: In
go pprof goroutine
result, we can see 1 goroutines associated with*RegionCache).asyncCheckAndResolveLoop
.Note: Several goroutines created by tikv/client-go may be visible to us in
go pprof goroutine
result as well.What is changed and how it works?
Use a server-level RegionCache instead of calling
tikv.NewRegionCache
every time a CDCClient is created. By this way, we can use exactly one goroutine for(*RegionCache).asyncCheckAndResolveLoop
.Check List
Tests
Release note