Create new threads more aggressively right after program start.

Refs #5050
This commit is contained in:
Gunnar Beutner 2013-11-15 12:26:56 +01:00
parent 9a93cc83b3
commit 979df4e110
3 changed files with 5 additions and 3 deletions

View File

@ -54,7 +54,8 @@ start() {
fi fi
echo "Starting Icinga 2: " echo "Starting Icinga 2: "
ulimit -n 8192 ulimit -n 32768
ulimit -s 512
$DAEMON -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG -u $ICINGA2_USER -g $ICINGA2_GROUP $DAEMON -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG -u $ICINGA2_USER -g $ICINGA2_GROUP
echo "Done" echo "Done"

View File

@ -23,6 +23,7 @@
#include "base/debug.h" #include "base/debug.h"
#include "base/utility.h" #include "base/utility.h"
#include "base/scriptvariable.h" #include "base/scriptvariable.h"
#include "base/application.h"
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <boost/bind.hpp> #include <boost/bind.hpp>
@ -254,7 +255,7 @@ void ThreadPool::ManagerThreadProc(void)
/* Spawn more workers if there are outstanding work items. */ /* Spawn more workers if there are outstanding work items. */
if (tthreads > 0 && pending > 0) if (tthreads > 0 && pending > 0)
tthreads = 8; tthreads = (Utility::GetTime() - Application::GetStartTime() < 300) ? 128 : 8;
std::ostringstream msgbuf; std::ostringstream msgbuf;
msgbuf << "Thread pool; current: " << alive << "; adjustment: " << tthreads; msgbuf << "Thread pool; current: " << alive << "; adjustment: " << tthreads;

View File

@ -73,7 +73,7 @@ private:
static int m_NextID; static int m_NextID;
boost::thread_group m_Threads; boost::thread_group m_Threads;
ThreadStats m_ThreadStats[512]; ThreadStats m_ThreadStats[4096];
double m_WaitTime; double m_WaitTime;
double m_ServiceTime; double m_ServiceTime;