Skip to content

Commit

Permalink
Change fanout limit check when thread affinity is true
Browse files Browse the repository at this point in the history
Summary: The limit of 32K is only one client to one single destination. Its not related to other hosts. With X proxies, we can open 32K/X connections from each proxy, giving a total of 32K across all proxies to a single server. With thread affinity, we only use one thread, so the limit is 32K/1 = 32K.

Reviewed By: stuclar

Differential Revision: D65549333

fbshipit-source-id: 8036dd29de14dedadf9120f47f58623f8d80b36b
  • Loading branch information
Xiaofei Hu authored and facebook-github-bot committed Nov 11, 2024
1 parent 4450ce9 commit cbf97f7
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions mcrouter/routes/RoutingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,22 @@ uint32_t getAdditionalFanout(

checkLogic(jAdditionalFanout->isInt(), "additional_fanout is not an integer");
uint32_t additionalFanout = jAdditionalFanout->getInt();

checkLogic(
static_cast<uint64_t>(additionalFanout + 1) *
static_cast<uint64_t>(opts.num_proxies) <=
kMaxTotalFanout,
"(additional_fanout={} + 1) * num_proxies={} must be <= {}",
additionalFanout,
opts.num_proxies,
kMaxTotalFanout);
if (!opts.thread_affinity) {
checkLogic(
static_cast<uint64_t>(additionalFanout + 1) *
static_cast<uint64_t>(opts.num_proxies) <=
kMaxTotalFanout,
"(additional_fanout={} + 1) * num_proxies={} must be <= {}",
additionalFanout,
opts.num_proxies,
kMaxTotalFanout);
} else {
checkLogic(
static_cast<uint64_t>(additionalFanout + 1) <= kMaxTotalFanout,
"(additional_fanout={} + 1) must be <= {}",
additionalFanout,
kMaxTotalFanout);
}

return additionalFanout;
}
Expand Down

0 comments on commit cbf97f7

Please sign in to comment.