Backport #65819 to 24.6: Respect cgroup CPU limit in Keeper

This commit is contained in:
robot-clickhouse 2024-07-01 08:12:31 +00:00
parent dcced7c847
commit 1237f2e4fa

View File

@ -7,11 +7,12 @@
#include <mutex> #include <mutex>
#include <string> #include <string>
#include <Coordination/KeeperLogStore.h> #include <Coordination/KeeperLogStore.h>
#include <Coordination/KeeperSnapshotManagerS3.h>
#include <Coordination/KeeperStateMachine.h> #include <Coordination/KeeperStateMachine.h>
#include <Coordination/KeeperStateManager.h> #include <Coordination/KeeperStateManager.h>
#include <Coordination/KeeperSnapshotManagerS3.h>
#include <Coordination/LoggerWrapper.h> #include <Coordination/LoggerWrapper.h>
#include <Coordination/WriteBufferFromNuraftBuffer.h> #include <Coordination/WriteBufferFromNuraftBuffer.h>
#include <Disks/DiskLocal.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
@ -27,7 +28,7 @@
#include <Common/LockMemoryExceptionInThread.h> #include <Common/LockMemoryExceptionInThread.h>
#include <Common/Stopwatch.h> #include <Common/Stopwatch.h>
#include <Common/getMultipleKeysFromConfig.h> #include <Common/getMultipleKeysFromConfig.h>
#include <Disks/DiskLocal.h> #include <Common/getNumberOfPhysicalCPUCores.h>
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <fmt/chrono.h> #include <fmt/chrono.h>
@ -365,6 +366,8 @@ void KeeperServer::launchRaftServer(const Poco::Util::AbstractConfiguration & co
LockMemoryExceptionInThread::removeUniqueLock(); LockMemoryExceptionInThread::removeUniqueLock();
}; };
asio_opts.thread_pool_size_ = getNumberOfPhysicalCPUCores();
if (state_manager->isSecure()) if (state_manager->isSecure())
{ {
#if USE_SSL #if USE_SSL