-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
store/copr: optimize copIterator by avoid start new goroutine #57522
Conversation
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
…-iter0 Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Hi @crazycs520. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #57522 +/- ##
================================================
+ Coverage 73.2097% 73.6562% +0.4465%
================================================
Files 1679 1679
Lines 462339 462466 +127
================================================
+ Hits 338477 340635 +2158
+ Misses 103082 101054 -2028
+ Partials 20780 20777 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest-required |
@crazycs520: Cannot trigger testing until a trusted user reviews the PR and leaves an 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-sigs/prow repository. |
/retest-required |
@crazycs520: Cannot trigger testing until a trusted user reviews the PR and leaves an 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-sigs/prow repository. |
@@ -85,6 +85,9 @@ type DistSQLContext struct { | |||
SessionAlias string | |||
|
|||
ExecDetails *execdetails.SyncExecDetails | |||
|
|||
// Only one cop-reader can use lite worker. Using lite-worker in multiple readers will affect the concurrent execution of readers. | |||
TryCopLiteWorker uint32 |
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.
I'm inclined that the TryCopLiteWorker
is a request level option.
Like an index lookup with 1 row result set. If TryCopLiteWorker
is a session level option, it's only enabled once in index scan, and in table lookup, the atomic.CompareAndSwapUint32(tryCopLiteWorker, 0, 1)
will fail and execute with multi-goroutine model.
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.
I'm afraid that make TryCopLiteWorker
in request
level option may have similar problem in this comment, there is a known case and I have added test for it. And I'm not sure if there are other cases like this, so I prefer keep TryCopLiteWorker
to be statement level.
As index lookup with 1 row result set, you are right, but because of the above problems, I don't have a good way to fix this.
Signed-off-by: crazycs520 <crazycs520@gmail.com>
/retest-required |
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, once we have async kv interface, we can remove TryCopLiteWorker
and make more coprocessor tasks benefit from this opimization.
Wait for @cfzjywxk's approve.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfzjywxk, zyguan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
@cfzjywxk: Cannot trigger testing until a trusted user reviews the PR and leaves an 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-sigs/prow repository. |
/ok-to-test |
/retest |
/retest-required |
What problem does this PR solve?
Issue Number: ref #56649
Problem Summary: optimize cop iterator by avoid start new goroutine
What changed and how does it work?
Before this PR,
copIterator
always start at least 1 copIteratorWorker goroutine and 1 copIteratorTaskSender goroutine. That's too wasteful for small queries.This PR avoid start new goroutine for small queries, for better performance, following is the sysbench oltp_index_scan test, and the range size is 2:
The example query is like this:
Which Plan is:
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.