diff --git a/include/InformationManager.h b/include/InformationManager.h index 4edcb2561f..5563b63394 100644 --- a/include/InformationManager.h +++ b/include/InformationManager.h @@ -20,6 +20,7 @@ #include "MadManager.h" #include "ActionManager.h" #include "InformationManagerDriver.h" +#include "MonitorThread.h" using namespace std; @@ -38,6 +39,7 @@ public: time_t _timer_period, time_t _monitor_period, int _host_limit, + int _monitor_threads, const string& _remotes_location, vector& _mads) :MadManager(_mads), @@ -46,7 +48,8 @@ public: timer_period(_timer_period), monitor_period(_monitor_period), host_limit(_host_limit), - remotes_location(_remotes_location) + remotes_location(_remotes_location), + mtpool(_monitor_threads) { am.addListener(this); }; @@ -141,6 +144,11 @@ private: */ ActionManager am; + /** + * Pool of threads to process each monitor message + */ + MonitorThreadPool mtpool; + /** * Function to execute the Manager action loop method within a new pthread * (requires C linkage) diff --git a/include/InformationManagerDriver.h b/include/InformationManagerDriver.h index 59556b7339..02c65f85f7 100644 --- a/include/InformationManagerDriver.h +++ b/include/InformationManagerDriver.h @@ -40,7 +40,8 @@ public: InformationManagerDriver( int userid, const map& attrs, - bool sudo); + bool sudo, + MonitorThreadPool * mtpool); virtual ~InformationManagerDriver(); @@ -75,6 +76,9 @@ public: private: friend class InformationManager; + /** + * Pointer to the Monitor Thread Pool to process monitor messages + */ MonitorThreadPool * mtpool; }; diff --git a/share/etc/oned.conf b/share/etc/oned.conf index b1e37fa22c..cca9d3c478 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -10,6 +10,8 @@ # # MONITORING_INTERVAL: Time in seconds between host and VM monitorization. # +# MONITORING_THREADS: Max. number of threads used to process monitor messages +# # HOST_PER_INTERVAL: Number of hosts monitored in each interval. # HOST_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring # information. Use 0 to disable HOST monitoring recording. @@ -52,7 +54,8 @@ LOG = [ #MANAGER_TIMER = 30 -MONITORING_INTERVAL = 60 +MONITORING_INTERVAL = 60 +MONITORING_THREADS = 50 #HOST_PER_INTERVAL = 15 #HOST_MONITORING_EXPIRATION_TIME = 43200 diff --git a/src/im/InformationManager.cc b/src/im/InformationManager.cc index 9bdc5ceb5c..107c9a3c58 100644 --- a/src/im/InformationManager.cc +++ b/src/im/InformationManager.cc @@ -71,7 +71,7 @@ int InformationManager::load_mads(int uid) NebulaLog::log("InM",Log::INFO,oss); - im_mad = new InformationManagerDriver(0,vattr->value(),false); + im_mad = new InformationManagerDriver(0,vattr->value(),false,&mtpool); rc = add(im_mad); diff --git a/src/im/InformationManagerDriver.cc b/src/im/InformationManagerDriver.cc index 28176d1c74..938145f811 100644 --- a/src/im/InformationManagerDriver.cc +++ b/src/im/InformationManagerDriver.cc @@ -27,21 +27,13 @@ /* -------------------------------------------------------------------------- */ InformationManagerDriver::InformationManagerDriver( - int userid, - const map& attrs, - bool sudo): - Mad(userid,attrs,sudo) -{ - mtpool = new MonitorThreadPool(100); -}; + int userid, + const map& attrs, + bool sudo, + MonitorThreadPool * _mtpool): + Mad(userid,attrs,sudo), mtpool(_mtpool){}; -InformationManagerDriver::~InformationManagerDriver() -{ - if (mtpool != 0) - { - delete mtpool; - } -}; +InformationManagerDriver::~InformationManagerDriver(){}; /* ************************************************************************** */ /* Driver ASCII Protocol Implementation */ diff --git a/src/nebula/Nebula.cc b/src/nebula/Nebula.cc index c7d330d582..312c7b956e 100644 --- a/src/nebula/Nebula.cc +++ b/src/nebula/Nebula.cc @@ -724,10 +724,14 @@ void Nebula::start(bool bootstrap_only) try { vector im_mads; - int host_limit; + + int host_limit; + int monitor_threads; nebula_configuration->get("HOST_PER_INTERVAL", host_limit); + nebula_configuration->get("MONITORING_THREADS", monitor_threads); + nebula_configuration->get("IM_MAD", im_mads); im = new InformationManager(hpool, @@ -735,6 +739,7 @@ void Nebula::start(bool bootstrap_only) timer_period, monitor_period, host_limit, + monitor_threads, remotes_location, im_mads); } diff --git a/src/nebula/NebulaTemplate.cc b/src/nebula/NebulaTemplate.cc index 66ce0899d6..825781cbb1 100644 --- a/src/nebula/NebulaTemplate.cc +++ b/src/nebula/NebulaTemplate.cc @@ -90,6 +90,7 @@ void OpenNebulaTemplate::set_conf_default() # Daemon configuration attributes #------------------------------------------------------------------------------- # MONITORING_INTERVAL +# MONITORING_THREADS # HOST_PER_INTERVAL # HOST_MONITORING_EXPIRATION_TIME # VM_PER_INTERVAL @@ -107,6 +108,12 @@ void OpenNebulaTemplate::set_conf_default() attribute = new SingleAttribute("MONITORING_INTERVAL",value); conf_default.insert(make_pair(attribute->name(),attribute)); + // MONITORING_THREADS + value = "50"; + + attribute = new SingleAttribute("MONITORING_THREADS",value); + conf_default.insert(make_pair(attribute->name(),attribute)); + // HOST_PER_INTERVAL value = "15";