Skip to content

Commit 3b4d11b

Browse files
authored
use logical cpu cores as the default pool size of grpc async client pool (#10143)
ref #6233 Signed-off-by: xufei <[email protected]>
1 parent 1d3b08c commit 3b4d11b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

dbms/src/Common/getNumberOfCPUCores.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
namespace CPUCores
2121
{
2222
UInt16 number_of_logical_cpu_cores = std::thread::hardware_concurrency();
23-
UInt16 number_of_physical_cpu_cores = std::thread::hardware_concurrency() / 2;
23+
// physical cpu cores should not be 0
24+
UInt16 number_of_physical_cpu_cores = std::max<UInt16>(1, std::thread::hardware_concurrency() / 2);
2425
} // namespace CPUCores
2526

2627

dbms/src/Server/Server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ try
12201220
{
12211221
auto size = settings.grpc_completion_queue_pool_size;
12221222
if (size == 0)
1223-
size = std::thread::hardware_concurrency();
1223+
size = getNumberOfLogicalCPUCores();
12241224
GRPCCompletionQueuePool::global_instance = std::make_unique<GRPCCompletionQueuePool>(size);
12251225
}
12261226

0 commit comments

Comments
 (0)