]> granicus.if.org Git - icinga2/commitdiff
IoEngine: adjust I/O threads
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Thu, 21 Feb 2019 09:08:38 +0000 (10:08 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 1 Apr 2019 11:31:16 +0000 (13:31 +0200)
lib/base/io-engine.cpp

index 0079ca251d0121cfa9661c49c225074e4141cd19..c93a4d87a489a544e4894716c84aa1b718994a49 100644 (file)
@@ -99,17 +99,10 @@ boost::asio::io_service& IoEngine::GetIoService()
        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);
-
-       auto concurrency (std::thread::hardware_concurrency());
-
-       if (concurrency < 2) {
-               m_CpuBoundSemaphore.store(1);
-       } else {
-               m_CpuBoundSemaphore.store(concurrency - 1u);
-       }
+       m_CpuBoundSemaphore.store(std::thread::hardware_concurrency() * 3u / 2u);
 
        for (auto& thread : m_Threads) {
                thread = std::thread(&IoEngine::RunEventLoop, this);