Skip to content

Commit a4b9441

Browse files
duxiao1212facebook-github-bot
authored andcommitted
[Prestissimo] Add stall thread monitoring to Spiller cpu pool
Summary: as title Differential Revision: D87850298
1 parent 42c6d5f commit a4b9441

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

presto-native-execution/presto_cpp/main/PrestoServer.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ void PrestoServer::run() {
548548
}
549549
if (spillerExecutor_ != nullptr) {
550550
PRESTO_STARTUP_LOG(INFO)
551-
<< "Spiller CPU executor '" << spillerExecutor_->getName() << "', has "
552-
<< spillerExecutor_->numThreads() << " threads.";
551+
<< "Spiller CPU executor '" << spillerCpuExecutor_->getName()
552+
<< "', has " << spillerCpuExecutor_->numThreads() << " threads.";
553553
} else {
554554
PRESTO_STARTUP_LOG(INFO) << "Spill executor was not configured.";
555555
}
@@ -560,7 +560,7 @@ void PrestoServer::run() {
560560
auto* asyncDataCache = velox::cache::AsyncDataCache::getInstance();
561561
periodicTaskManager_ = std::make_unique<PeriodicTaskManager>(
562562
driverCpuExecutor_,
563-
spillerExecutor_.get(),
563+
spillerCpuExecutor_,
564564
httpSrvIoExecutor_.get(),
565565
httpSrvCpuExecutor_.get(),
566566
exchangeHttpIoExecutor_.get(),
@@ -854,9 +854,11 @@ void PrestoServer::initializeThreadPools() {
854854
const auto numSpillerCpuThreads = std::max<size_t>(
855855
systemConfig->spillerNumCpuThreadsHwMultiplier() * hwConcurrency, 0);
856856
if (numSpillerCpuThreads > 0) {
857-
spillerExecutor_ = std::make_unique<folly::CPUThreadPoolExecutor>(
857+
auto spillerExecutor = std::make_unique<folly::CPUThreadPoolExecutor>(
858858
numSpillerCpuThreads,
859859
std::make_shared<folly::NamedThreadFactory>("Spiller"));
860+
spillerCpuExecutor_ = spillerExecutor.get();
861+
spillerExecutor_ = std::move(spillerExecutor);
860862
}
861863

862864
const auto numExchangeHttpClientIoThreads = std::max<size_t>(
@@ -1793,7 +1795,7 @@ void PrestoServer::registerDynamicFunctions() {
17931795

17941796
void PrestoServer::createTaskManager() {
17951797
taskManager_ = std::make_unique<TaskManager>(
1796-
driverExecutor_.get(), httpSrvCpuExecutor_.get(), spillerExecutor_.get());
1798+
driverCpuExecutor_, httpSrvCpuExecutor_.get(), spillerCpuExecutor_);
17971799
}
17981800

17991801
void PrestoServer::reportNodeStats(proxygen::ResponseHandler* downstream) {

presto-native-execution/presto_cpp/main/PrestoServer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ class PrestoServer {
269269
folly::CPUThreadPoolExecutor* driverCpuExecutor_;
270270

271271
// Executor for spilling.
272-
std::unique_ptr<folly::CPUThreadPoolExecutor> spillerExecutor_;
272+
std::unique_ptr<folly::Executor> spillerExecutor_;
273+
folly::CPUThreadPoolExecutor* spillerCpuExecutor_;
273274

274275
std::unique_ptr<VeloxPlanValidator> planValidator_;
275276

0 commit comments

Comments
 (0)