Skip to content

Conversation

56quarters
Copy link
Contributor

@56quarters 56quarters commented Jun 7, 2022

What this PR does

Remove use of a dedicated thread pool for store-gateway requests. Instead,
only use the thread pool for creation of new indexheader.Reader instances
since this is when most I/O on memory mapped files happens.

Using dedicated threads for entire requests introduced a new way for store-
gateways to fail when becoming overloaded. Since the threads in the pool are
a constrained resource, when slow requests monopolize them all other requests
are blocked waiting for a thread. By moving use of the thread pool to
creation of indexheader.Reader instances, we minimize the amount of time
that a thread must be used for while also making sure that we don't use
the thread pool at all when not needed.

Signed-off-by: Nick Pillitteri nick.pillitteri@grafana.com

Which issue(s) this PR fixes or relates to

N/A

Checklist

  • Tests updated
  • [NA] Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@56quarters 56quarters force-pushed the 56quarters/threadpool-reader-creation branch from 3b435a8 to e21e7f7 Compare June 7, 2022 20:05
@56quarters 56quarters force-pushed the 56quarters/threadpool-reader-creation branch from e21e7f7 to 75eead4 Compare June 8, 2022 19:00
@56quarters 56quarters marked this pull request as ready for review June 15, 2022 17:14
@56quarters
Copy link
Contributor Author

Marking this as ready for review since we're still in the process of testing #2019. If it turns out #2019 is sufficient to mitigate the issue, we can remove use of the threadpool entirely. However, there's no harm in adding this feature and leaving it disabled while gathering more information (and based on testing, using the threadpool for requests is not the correct solution).

@stevesg stevesg self-requested a review June 22, 2022 09:01
Remove use of a dedicated thread pool for store-gateway requests. Instead,
only use the thread pool for creation of new indexheader.Reader instances
since this is when most I/O on memory mapped files happens.

Using dedicated threads for entire requests introduced a new way for store-
gateways to fail when becoming overloaded. Since the threads in the pool are
a constrained resource, when slow requests monopolize them all other requests
are blocked waiting for a thread. By moving use of the thread pool to
creation of indexheader.Reader instances, we minimize the amount of time
that a thread must be used for while also making sure that we don't use
the thread pool at all when not needed.

Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
@56quarters 56quarters force-pushed the 56quarters/threadpool-reader-creation branch from 75eead4 to 7fe6648 Compare July 12, 2022 19:46
@56quarters
Copy link
Contributor Author

Superseded by #2019. Removed existing code in #2423

@56quarters 56quarters closed this Jul 14, 2022
@56quarters 56quarters deleted the 56quarters/threadpool-reader-creation branch April 24, 2025 14:25
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.

1 participant