-
Notifications
You must be signed in to change notification settings - Fork 287
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 worker pool in region worker #1481
kv-client: use worker pool in region worker #1481
Conversation
34ed9e2
to
f46e923
Compare
9d0912b
to
531d440
Compare
d6da339
to
168a20b
Compare
/run-all-tests |
1 similar comment
/run-all-tests |
3c6d569
to
4dc2f83
Compare
/run-all-tests |
1 similar comment
/run-all-tests |
PTAL @liuzix @leoppro @overvenus |
func Test(t *testing.T) { check.TestingT(t) } | ||
func Test(t *testing.T) { | ||
conf := config.GetDefaultServerConfig() | ||
config.StoreGlobalServerConfig(conf) |
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.
should we set a default config in init
function?
@@ -263,6 +264,10 @@ func (s *Server) run(ctx context.Context) (err error) { | |||
return sorter.RunWorkerPool(cctx) | |||
}) | |||
|
|||
wg.Go(func() error { |
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.
maybe we can run worker pool in init
function?
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 either run it in init
function or explicit invocation works, but IMHO the init
function is a little dangerous in some scenarios, which may make initialization step unclear (such as init sequence, unexpected init when we import a package but don't want it to init, etc)
such as the discussion in this article: https://medium.com/higher-order-functions/golang-how-to-sensibly-use-init-function-8077a4ec15e5
/lgtm |
[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 writing |
/run-unit-tests |
regionWorkerPool workerpool.WorkerPool | ||
workerPoolOnce sync.Once | ||
// TODO: unified channel buffer mechanism | ||
regionWorkerInputChanSize = 128000 |
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 add a comment about this magic 128000?
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.
added some comments
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 862f695
|
/run-all-tests |
/run-kafka-tests |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #1802. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #1803. |
What problem does this PR solve?
Part of #1393
To increase the throughput of kv client, we should use multiple goroutines in region worker
What is changed and how it works?
github.com/pingcap/ticdc/pkg/workerpool
Check List
Tests
Release note