Skip to content

Commit

Permalink
Add core_multiplier_threshold option v2
Browse files Browse the repository at this point in the history
Summary: Threshold to enable customization of proxy threads using core-multiplier.

Reviewed By: alikhtarov

Differential Revision: D49329331

fbshipit-source-id: 9562d575ed54d5e72325be4aa875f49969b18d7a
  • Loading branch information
Stuart Clark authored and facebook-github-bot committed Sep 16, 2023
1 parent 5829468 commit 565f39e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mcrouter/StandaloneUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,11 @@ void setupStandaloneMcrouter(
standaloneOptions.updateFromDict(standaloneOptionsDict);

if (standaloneOptions.core_multiplier > 0) {
libmcrouterOptions.num_proxies *= standaloneOptions.core_multiplier;
auto c = std::thread::hardware_concurrency();
if (!standaloneOptions.core_multiplier_threshold ||
c >= standaloneOptions.core_multiplier_threshold) {
libmcrouterOptions.num_proxies = c * standaloneOptions.core_multiplier;
}
}

if (libmcrouterOptions.enable_failure_logging) {
Expand Down
12 changes: 10 additions & 2 deletions mcrouter/standalone_options_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,18 @@ MCROUTER_OPTION_INTEGER(
MCROUTER_OPTION_DOUBLE(
double,
core_multiplier,
1.0,
0.0,
"core-multiplier",
no_short,
"When > 0, number of proxies used will be num-proxies * core-multiplier")
"When > 0, number of proxies used will be std::hardware_concurrency * core-multiplier")

MCROUTER_OPTION_INTEGER(
size_t,
core_multiplier_threshold,
0,
"core-multiplier-threshold",
no_short,
"core-mutiplier logic is applied if the number of cores >= core_multiplier_threshold")

#ifdef ADDITIONAL_STANDALONE_OPTIONS_FILE
#include ADDITIONAL_STANDALONE_OPTIONS_FILE
Expand Down

0 comments on commit 565f39e

Please sign in to comment.