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

util, executor: use a individual rowContainer for each probeWorker in HashJoinExec #27577

Merged
merged 5 commits into from
Sep 7, 2021

Conversation

XuHuaiyu
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #27576

Problem Summary:

What is changed and how it works?

Proposal: xxx

What's Changed:
Use an individual rowContainer for each probeWorker in HashJoinExec to eliminate the contention when accessing rowContainer.Mutex.

How it Works:

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
tidb_executor_concurrency lantency
2 20.78s
4 13.93s
8 8.18s
16 5.56s
32 3.42s

截屏2021-08-25 下午3 32 35

Side effects

N/A

Documentation

N/A

Release note

Improve the query performance for HashJoin.

@XuHuaiyu XuHuaiyu added type/enhancement The issue or PR belongs to an enhancement. sig/execution SIG execution component/executor labels Aug 25, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 25, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • guo-shaoge
  • wshwsh12

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.

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 25, 2021
@XuHuaiyu XuHuaiyu force-pushed the refine_rowcontainer_2 branch 3 times, most recently from 3377cae to 6cd3123 Compare August 31, 2021 09:56
@XuHuaiyu
Copy link
Contributor Author

XuHuaiyu commented Sep 1, 2021

The failed cases: TestShowGrantsForCurrentUserUsingRole and TestIterator have nothing to do with this commit.

Comment on lines 48 to 49
// spillError stores the error when spilling.
spillError error
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we put spillError into rowContainerRecord? When there is a spilling error, all goroutions can observe the error and exit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

spillError is of the interface type, it seems we do not need to put it in rowContainerRecord

executor/hash_table.go Show resolved Hide resolved
@@ -115,7 +125,7 @@ func (c *hashRowContainer) GetMatchedRowsAndPtrs(probeKey uint64, probeRow chunk
return
}
if !ok {
c.stat.probeCollision++
atomic.AddInt64(&c.stat.probeCollision, 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Guess this can be a new hotspot. Myabe we can let user control the HashTalbe's bucket size to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, the collision should be small probability event

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 6, 2021
@guo-shaoge
Copy link
Collaborator

/run-common-test
/run-integration-copr-test
/run-integration-common-test

Copy link
Contributor

@wshwsh12 wshwsh12 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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 6, 2021
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 7, 2021
@XuHuaiyu
Copy link
Contributor Author

XuHuaiyu commented Sep 7, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 2c15078

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

@XuHuaiyu: 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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/execution SIG execution size/XL Denotes a PR that changes 500-999 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. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bottleneck when accessing rowContainer.m.Mutex in HashJoinExec
4 participants