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 option to specify max threads based on num cpus #633

Merged

Conversation

aprudhomme
Copy link
Contributor

Add an alternative method for specifying the maximum number of threads for a thread pool. Allows you to compute number of threads based on the number of cpus, with the formula: (numCPUs * multiplier) + offset bound by a min and max.

The max threads are still specified by the threadPoolConfiguration.max*Threads config keys. If the config value is a number, the number is used directly as max threads (status quo). If the config is a dict, field values are used to compute the max threads.

Config fields:

  • min - minimum value for max threads, default: 1
  • max - maximum value for max threads, default: INT_MAX
  • multiplier - max threads formula multiplier, default: 1.0
  • offset - max threads formula offset, default: 0

Example:

threadPoolConfiguration:
  maxSearchingThreads:
    min: 5
    multiplier: 1.5

@aprudhomme aprudhomme requested a review from sarthakn7 March 15, 2024 23:12
@@ -39,6 +43,8 @@ public class ThreadPoolConfiguration {
private static final int DEFAULT_MAX_GRPC_REPLICATIONSERVER_BUFFERED_ITEMS =
DEFAULT_MAX_INDEXING_BUFFERED_ITEMS;

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
Copy link
Contributor

Choose a reason for hiding this comment

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

@aprudhomme aprudhomme requested a review from sarthakn7 March 16, 2024 00:50
@aprudhomme aprudhomme merged commit 223f620 into Yelp:master Mar 18, 2024
1 check passed
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.

2 participants