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

Less aggressive async pruning for RubyThreadPoolExecutor #1079

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joshuay03
Copy link

@joshuay03 joshuay03 commented Jan 17, 2025

Fixes #1066

Issue script output with this patch
0
4
4
4
1
pool should ideally be scaled up here
4
1
1
1
4
4
4
1
1
1
1

Adds a pruner thread to RubyThreadPoolExecutor with the intention of making pruning a lot less aggressive which should reduce the likelihood of prematurely scaling down the size of the pool right after being assigned a large workload.

DEFAULT_THREAD_IDLETIMEOUT = 60

# @!macro thread_pool_executor_constant_default_pool_prune_timeout
DEFAULT_POOL_PRUNETIMEOUT = 30
Copy link
Author

Choose a reason for hiding this comment

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

A somewhat arbitrary number, but this is also what puma uses.

@joshuay03 joshuay03 force-pushed the add-pruner-thread-to-ruby-thread-pool-executor branch from b5dd976 to 6e5e003 Compare January 17, 2025 08:44
@eregon
Copy link
Collaborator

eregon commented Jan 17, 2025

Have you seen #1075? It seems quite related.
Would this PR solve that issue too?

@joshuay03
Copy link
Author

joshuay03 commented Jan 17, 2025

Have you seen #1075? It seems quite related. Would this PR solve that issue too?

Oh I haven't, last I checked was when I opened my issue and there wasn't anything similar. Yes this should solve that too, I'll leave a comment there. Thank you.

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.

Unexpected pruning behaviour with consecutive task batches
2 participants