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

Add threadPool maximumSize configuration #1371

Merged

Conversation

mattrjacobs
Copy link
Contributor

With this change, it is possible to set coreSize < maximumSize and have a thread pool which can give up threads if they become inactive (subject to the keep-alive time).

Design considerations:

  • An IllegalArgumentException is thrown if a ThreadPoolExecutor is configured with coreSize > maximumSize. When that condition occurs when the constructor is invoked, this PR chooses to use coreSize for maximumSize to avoid the error and logs something to the user.
  • This PR uses the discovered coreSize as the default value for maximumSize. This should allow a clean migration, as no one currently has maximumValue configured. So without that config, Hystrix should configure itself as before - a fixed size threadpool of size coreSize. Further configuration can then set these independently.

This addresses #1242

@mattrjacobs mattrjacobs merged commit ae725f5 into Netflix:master Oct 5, 2016
@mattrjacobs mattrjacobs deleted the allow-excess-threads-to-be-terminated branch October 5, 2016 20:20
threadPool.setCorePoolSize(dynamicCoreSize);
threadPool.setMaximumPoolSize(dynamicCoreSize); // we always want maxSize the same as coreSize, we are not using a dynamically resizing pool
threadPool.setMaximumPoolSize(dynamicMaximumSize);
}

threadPool.setKeepAliveTime(properties.keepAliveTimeMinutes().get(), TimeUnit.MINUTES); // this doesn't really matter since we're not resizing
Copy link
Contributor

@bltb bltb Oct 7, 2016

Choose a reason for hiding this comment

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

@mattrjacobs , you might like to remove this comment about "this doesn't really matter" ... 😄

Copy link

@mukteshkrmishra mukteshkrmishra left a comment

Choose a reason for hiding this comment

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

Looks good.

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.

3 participants