Skip to content

Commit

Permalink
set up ThreadPoolExecutorCounters on FSChannelThreads
Browse files Browse the repository at this point in the history
Summary: This diff sets up ThreadPoolExecutorCounters on the bounded FSChannel thread pool

Reviewed By: kavehahmadi60

Differential Revision: D62920235

fbshipit-source-id: d4b640ecffa7e029e54896cb9130ada8c15a7002
  • Loading branch information
genevievehelsel authored and facebook-github-bot committed Sep 19, 2024
1 parent b38b7fa commit 7cabe50
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
16 changes: 11 additions & 5 deletions eden/fs/service/EdenServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
#endif

#ifdef EDEN_HAVE_SERVER_OBSERVER
#include "common/fb303/cpp/ThreadPoolExecutorCounters.h" // @manual
#include "eden/fs/service/facebook/ServerObserver.h" // @manual
#endif

Expand Down Expand Up @@ -304,11 +305,16 @@ std::shared_ptr<folly::Executor> makeFsChannelThreads(
return std::make_shared<UnboundedQueueExecutor>(
edenConfig->numFsChannelThreads.getValue(), "FsChannelThreadPool");
}
return std::make_shared<folly::CPUThreadPoolExecutor>(
edenConfig->numFsChannelThreads.getValue(),
std::make_unique<EdenTaskQueue>(
edenConfig->maxFsChannelInflightRequests.getValue()),
std::make_unique<folly::NamedThreadFactory>("FsChannelThreadPool"));
std::shared_ptr<folly::CPUThreadPoolExecutor> fsChannelThreads =
std::make_shared<folly::CPUThreadPoolExecutor>(
edenConfig->numFsChannelThreads.getValue(),
std::make_unique<EdenTaskQueue>(
edenConfig->maxFsChannelInflightRequests.getValue()),
std::make_unique<folly::NamedThreadFactory>("FsChannelThreadPool"));
#ifdef EDEN_HAVE_SERVER_OBSERVER
facebook::fb303::installThreadPoolExecutorCounters("", *fsChannelThreads);
#endif
return fsChannelThreads;
}

} // namespace
Expand Down
27 changes: 7 additions & 20 deletions eden/fs/service/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -313,29 +313,9 @@ cpp_library(
"ThriftPermissionChecker.cpp",
],
os_deps = [
# TODO: The edenfs_smartplatform_service dependency fans out to a ton
# of other dependencies, slowing down OSS builds and tests. We ideally
# should move it to facebook/main.cpp to avoid the cost in unit tests
# and OSS builds and tests.
(
"linux",
[
"//eden/fs/service/facebook:edenfs_smartplatform_service",
"//eden/fs/service/facebook:server_observer",
],
),
(
"macos",
[
"//eden/fs/service/facebook:edenfs_smartplatform_service",
"//eden/fs/service/facebook:server_observer",
],
),
(
"windows",
[
"//eden/fs/service/facebook:edenfs_smartplatform_service",
"//eden/fs/service/facebook:server_observer",
"//eden/fs/notifications:windows_notifier",
],
),
Expand All @@ -351,6 +331,7 @@ cpp_library(
":thrift_startup_status_subscriber",
":thrift_util",
":usage_service",
"//common/fb303/cpp:thread_pool_executor_counters", # @manual
"//eden/common/telemetry:log_info",
"//eden/common/telemetry:structured_logger_factory",
"//eden/common/utils:enum",
Expand All @@ -370,6 +351,12 @@ cpp_library(
"//eden/fs/notifications:null_notifier",
"//eden/fs/privhelper:interface",
"//eden/fs/prjfs:prjfs",
# TODO: The edenfs_smartplatform_service dependency fans out to a ton
# of other dependencies, slowing down OSS builds and tests. We ideally
# should move it to facebook/main.cpp to avoid the cost in unit tests
# and OSS builds and tests.
"//eden/fs/service/facebook:edenfs_smartplatform_service", # @manual
"//eden/fs/service/facebook:server_observer", # @manual
"//eden/fs/store:context",
"//eden/fs/store:filtered_backing_store",
"//eden/fs/store:rocksdb",
Expand Down

0 comments on commit 7cabe50

Please sign in to comment.