mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
IoEngine: adjust I/O threads
This commit is contained in:
parent
19625e62ef
commit
e26774c7f8
@ -99,17 +99,10 @@ boost::asio::io_service& IoEngine::GetIoService()
|
|||||||
return m_IoService;
|
return m_IoService;
|
||||||
}
|
}
|
||||||
|
|
||||||
IoEngine::IoEngine() : m_IoService(), m_KeepAlive(m_IoService), m_Threads(decltype(m_Threads)::size_type(std::thread::hardware_concurrency())), m_AlreadyExpiredTimer(m_IoService)
|
IoEngine::IoEngine() : m_IoService(), m_KeepAlive(m_IoService), m_Threads(decltype(m_Threads)::size_type(std::thread::hardware_concurrency() * 2u)), m_AlreadyExpiredTimer(m_IoService)
|
||||||
{
|
{
|
||||||
m_AlreadyExpiredTimer.expires_at(boost::posix_time::neg_infin);
|
m_AlreadyExpiredTimer.expires_at(boost::posix_time::neg_infin);
|
||||||
|
m_CpuBoundSemaphore.store(std::thread::hardware_concurrency() * 3u / 2u);
|
||||||
auto concurrency (std::thread::hardware_concurrency());
|
|
||||||
|
|
||||||
if (concurrency < 2) {
|
|
||||||
m_CpuBoundSemaphore.store(1);
|
|
||||||
} else {
|
|
||||||
m_CpuBoundSemaphore.store(concurrency - 1u);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& thread : m_Threads) {
|
for (auto& thread : m_Threads) {
|
||||||
thread = std::thread(&IoEngine::RunEventLoop, this);
|
thread = std::thread(&IoEngine::RunEventLoop, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user