1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

Feature #2245: Add xmlrpc concurrency paramenters to oned

(cherry picked from commit 4f271af67fcaac8993b6a56a2337b92590e1c57f)
This commit is contained in:
Javi Fontan 2013-07-31 12:28:13 +02:00 committed by Carlos Martín
parent d7cc47e762
commit 09a10e3dcc
3 changed files with 95 additions and 1 deletions

View File

@ -106,6 +106,31 @@ private:
*/
int socket_fd;
/**
* Max connections
*/
int max_conn;
/*
* Max backlog connections
*/
int max_conn_backlog;
/*
* Keepalive timeout
*/
int keepalive_timeout;
/*
* Keepalive max conn
*/
int keepalive_max_conn;
/*
* Timeout
*/
int timeout;
/**
* Filename for the log of the xmlrpc server that listens
*/

View File

@ -86,7 +86,7 @@ module OpenNebula
@one_endpoint = "http://localhost:2633/RPC2"
end
timeout=nil
timeout=1
timeout=options[:timeout] if options[:timeout]
@server = XMLRPC::Client.new2(@one_endpoint, nil, timeout)

View File

@ -78,6 +78,14 @@ extern "C" void * rm_action_loop(void *arg)
extern "C" void * rm_xml_server_loop(void *arg)
{
RequestManager * rm;
Nebula& nd = Nebula::instance();
string str;
ostringstream oss;
unsigned int max_conn = 15;
unsigned int max_conn_backlog = 15;
unsigned int keepalive_timeout = 15;
unsigned int keepalive_max_conn = 30;
unsigned int timeout = 15;
if ( arg == 0 )
{
@ -86,6 +94,62 @@ extern "C" void * rm_xml_server_loop(void *arg)
rm = static_cast<RequestManager *>(arg);
// Get configuration parameters
// MAX_CONN
nd.get_configuration_attribute("MAX_CONN", str);
if (!str.empty())
{
max_conn = atoi(str.c_str());
}
oss << "max_conn: " << max_conn;
NebulaLog::log("ReM",Log::DEBUG, oss);
// MAX_CONN_BACKLOG
nd.get_configuration_attribute("MAX_CONN_BACKLOG", str);
if (!str.empty())
{
max_conn_backlog = atoi(str.c_str());
}
oss.str("");
oss << "max_conn_backlog: " << max_conn_backlog;
NebulaLog::log("ReM",Log::DEBUG, oss);
// KEEPALIVE_TIMEOUT
nd.get_configuration_attribute("KEEPALIVE_TIMEOUT", str);
if (!str.empty())
{
keepalive_timeout = atoi(str.c_str());
}
oss.str("");
oss << "keepalive_timeout: " << keepalive_timeout;
NebulaLog::log("ReM",Log::DEBUG, oss);
// KEEPALIVE_MAX_CONN
nd.get_configuration_attribute("KEEPALIVE_MAX_CONN", str);
if (!str.empty())
{
keepalive_max_conn = atoi(str.c_str());
}
oss.str("");
oss << "keepalive_max_conn: " << keepalive_max_conn;
NebulaLog::log("ReM",Log::DEBUG, oss);
// TIMEOUT
nd.get_configuration_attribute("TIMEOUT", str);
if (!str.empty())
{
timeout = atoi(str.c_str());
}
oss.str("");
oss << "timeout: " << timeout;
NebulaLog::log("ReM",Log::DEBUG, oss);
// Set cancel state for the thread
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0);
@ -97,6 +161,11 @@ extern "C" void * rm_xml_server_loop(void *arg)
rm->AbyssServer = new xmlrpc_c::serverAbyss(xmlrpc_c::serverAbyss::constrOpt()
.registryP(&rm->RequestManagerRegistry)
.logFileName(rm->xml_log_file)
.maxConn(max_conn)
.maxConnBacklog(max_conn_backlog)
.keepaliveTimeout(keepalive_timeout)
.keepaliveMaxConn(keepalive_max_conn)
.timeout(timeout)
.socketFd(rm->socket_fd));
rm->AbyssServer->run();