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

enhance: Reduce unnecessary goroutines during search #32703

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bigsheeper
Copy link
Contributor

@bigsheeper bigsheeper commented Apr 29, 2024

Since SQ thread pool is present in cgo.Search, allocating goroutines at the segments level for concurrency is unnecessary. Simply use the thread pool directly at the segments level to avoid extra goroutines.

issue: #27456

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bigsheeper
To complete the pull request process, please assign czs007 after the PR has been reviewed.
You can assign the PR to them by writing /assign @czs007 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot added the size/L Denotes a PR that changes 100-499 lines. label Apr 29, 2024
@mergify mergify bot added dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement labels Apr 29, 2024
Signed-off-by: bigsheeper <[email protected]>
Copy link
Contributor

mergify bot commented Apr 29, 2024

@bigsheeper ut workflow job failed, comment rerun ut can trigger the job again.

Signed-off-by: bigsheeper <[email protected]>
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

Attention: Patch coverage is 85.96491% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 81.74%. Comparing base (83ce352) to head (ecf5b75).
Report is 12 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #32703      +/-   ##
==========================================
- Coverage   81.77%   81.74%   -0.03%     
==========================================
  Files        1001     1002       +1     
  Lines      125359   125435      +76     
==========================================
+ Hits       102517   102542      +25     
- Misses      18956    18997      +41     
- Partials     3886     3896      +10     
Files Coverage Δ
internal/querynodev2/segments/segment.go 66.87% <100.00%> (-0.21%) ⬇️
internal/querynodev2/segments/search.go 63.63% <76.92%> (+0.96%) ⬆️
internal/querynodev2/segments/retrieve.go 79.66% <76.19%> (+0.66%) ⬆️

... and 34 files with indirect coverage changes

@mergify mergify bot added the ci-passed label Apr 29, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

It's recommended to leave SQPool usage in segment to make sure all search/query operations using cgo pool in case of future misuse out side

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean that I should create a new pool for this, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

nope. I suggested that the SQPool usage shall remain in segment.Search/Query method. search/queryOnSegment shall using a simple for-loop is good enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it, make sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the solution of keeping SQPool usage within the segment, we need to return the future objects to the out side scope. However, when I attempted to make this modification, the code became more convoluted and monitoring metric was disrupted. Taking all this into consideration, I would suggest keeping with the current approach.
BTW, the SQPool is already being used out side (in RetrieveByOffsets).
@congqixia

@mergify mergify bot removed the ci-passed label May 7, 2024
Copy link
Contributor

mergify bot commented May 7, 2024

@bigsheeper E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

Copy link
Contributor

mergify bot commented May 7, 2024

@bigsheeper ut workflow job failed, comment rerun ut can trigger the job again.

@mergify mergify bot added the ci-passed label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-passed dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement size/L Denotes a PR that changes 100-499 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants