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

Pass a context to the query worker pool #3350

Merged
merged 6 commits into from
Mar 31, 2021
Merged

Conversation

ryanhall07
Copy link
Collaborator

This ensures requests that have already timed out don't stick around
waiting for a worker to complete the request.

What this PR does / why we need it:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:


Does this PR require updating code package or user-facing documentation?:


This ensures requests that have already timed out don't stick around
waiting for a worker to complete the request.
@codecov
Copy link

codecov bot commented Mar 12, 2021

Codecov Report

Merging #3350 (4f099f0) into master (49f8c14) will decrease coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #3350     +/-   ##
=========================================
- Coverage    72.3%    72.3%   -0.1%     
=========================================
  Files        1098     1098             
  Lines      102107   102109      +2     
=========================================
- Hits        73903    73898      -5     
- Misses      23103    23106      +3     
- Partials     5101     5105      +4     
Flag Coverage Δ
aggregator 76.8% <ø> (ø)
cluster 84.9% <ø> (-0.1%) ⬇️
collector 84.3% <ø> (ø)
dbnode 78.9% <ø> (-0.1%) ⬇️
m3em 74.4% <ø> (ø)
m3ninx 73.5% <ø> (ø)
metrics 19.8% <ø> (ø)
msg 74.6% <ø> (ø)
query 66.9% <100.0%> (+<0.1%) ⬆️
x 80.3% <ø> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49f8c14...4f099f0. Read the comment docs.

@robskillington
Copy link
Collaborator

Mainly looks good to me although i do worry about what happens when you have 10,000 series and how much lock contention/overhead will happen checking the context for every single one of them - you kind of want to check the context say “every N” series to amortize that cost ideally (although, how complicated is that, can that be achieved by changing which worker pool method to call every N series? shrug)

Copy link
Collaborator

@wesleyk wesleyk left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@arnikola arnikola left a comment

Choose a reason for hiding this comment

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

LGTM

The fast wrappers allow a caller to amortize the cost of checking the
Done channel over a batchSize of iterations.
@@ -101,6 +103,7 @@ func toPromConcurrently(
mu sync.Mutex
)

fastWorkerPool := readWorkerPool.Fast(100)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should we make this Java-like and more explicit what you get back here, i.e. make the method calledFastGoWithContextWorkerPool? Otherwise it's not clear that only the GoWithContext is fast (and the other methods are the same).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FastGoWithContextWorkerPoolFactoryProviderBean ? j/k will change.

Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

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

@ryanhall07 ryanhall07 enabled auto-merge (squash) March 31, 2021 14:01
@ryanhall07 ryanhall07 enabled auto-merge (squash) March 31, 2021 14:30
@ryanhall07 ryanhall07 merged commit 1843061 into master Mar 31, 2021
@ryanhall07 ryanhall07 deleted the rhall-worker-pool-ctx branch March 31, 2021 14:42
soundvibe added a commit that referenced this pull request Apr 6, 2021
* master:
  [DOCS] Configuration and component section overhaul (#3324)
  Pass a context to the query worker pool (#3350)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants