Commit 34f832fa authored by Howard Chu's avatar Howard Chu
Browse files

Multiple queues per threadpool

parent f230503b
......@@ -213,6 +213,13 @@ ldap_pvt_thread_pool_init LDAP_P((
int max_threads,
int max_pending ));
LDAP_F( int )
ldap_pvt_thread_pool_init_q LDAP_P((
ldap_pvt_thread_pool_t *pool_out,
int max_threads,
int max_pending,
int num_qs ));
LDAP_F( int )
ldap_pvt_thread_pool_submit LDAP_P((
ldap_pvt_thread_pool_t *pool,
......
This diff is collapsed.
......@@ -198,6 +198,7 @@ enum {
CFG_LTHREADS,
CFG_IX_HASH64,
CFG_DISABLED,
CFG_THREADQS,
CFG_LAST
};
......@@ -683,6 +684,14 @@ static ConfigTable config_back_cf_table[] = {
#endif
"( OLcfgGlAt:66 NAME 'olcThreads' "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
{ "threadqueues", "count", 2, 2, 0,
#ifdef NO_THREADS
ARG_IGNORED, NULL,
#else
ARG_INT|ARG_MAGIC|CFG_THREADQS, &config_generic,
#endif
"( OLcfgGlAt:95 NAME 'olcThreadQueues' "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
{ "timelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
&config_timelimit, "( OLcfgGlAt:67 NAME 'olcTimeLimit' "
"SYNTAX OMsDirectoryString )", NULL, NULL },
......@@ -835,7 +844,8 @@ static ConfigOCs cf_ocs[] = {
"olcDisallows $ olcGentleHUP $ olcIdleTimeout $ "
"olcIndexSubstrIfMaxLen $ olcIndexSubstrIfMinLen $ "
"olcIndexSubstrAnyLen $ olcIndexSubstrAnyStep $ olcIndexHash64 $ "
"olcIndexIntLen $ olcLocalSSF $ olcLogFile $ olcLogLevel $ "
"olcIndexIntLen $ "
"olcListenerThreads $ olcLocalSSF $ olcLogFile $ olcLogLevel $ "
"olcPasswordCryptSaltFormat $ olcPasswordHash $ olcPidFile $ "
"olcPluginLogFile $ olcReadOnly $ olcReferral $ "
"olcReplogFile $ olcRequires $ olcRestrict $ olcReverseLookup $ "
......@@ -845,7 +855,8 @@ static ConfigOCs cf_ocs[] = {
"olcSecurity $ olcServerID $ olcSizeLimit $ "
"olcSockbufMaxIncoming $ olcSockbufMaxIncomingAuth $ "
"olcTCPBuffer $ "
"olcThreads $ olcTimeLimit $ olcTLSCACertificateFile $ "
"olcThreads $ olcThreadQueues $ "
"olcTimeLimit $ olcTLSCACertificateFile $ "
"olcTLSCACertificatePath $ olcTLSCertificateFile $ "
"olcTLSCertificateKeyFile $ olcTLSCipherSuite $ olcTLSCRLCheck $ "
"olcTLSRandFile $ olcTLSVerifyClient $ olcTLSDHParamFile $ "
......@@ -947,6 +958,9 @@ config_generic(ConfigArgs *c) {
case CFG_THREADS:
c->value_int = connection_pool_max;
break;
case CFG_THREADQS:
c->value_int = connection_pool_queues;
break;
case CFG_TTHREADS:
c->value_int = slap_tool_thread_max;
break;
......@@ -1314,6 +1328,7 @@ config_generic(ConfigArgs *c) {
/* single-valued attrs, no-ops */
case CFG_CONCUR:
case CFG_THREADS:
case CFG_THREADQS:
case CFG_TTHREADS:
case CFG_LTHREADS:
case CFG_RO:
......@@ -1693,6 +1708,18 @@ config_generic(ConfigArgs *c) {
connection_pool_max = c->value_int; /* save for reference */
break;
case CFG_THREADQS:
if ( c->value_int < 1 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ),
"threadqueuess=%d smaller than minimum value 1",
c->value_int );
Debug(LDAP_DEBUG_ANY, "%s: %s.\n",
c->log, c->cr_msg, 0 );
return 1;
}
connection_pool_queues = c->value_int; /* save for reference */
break;
case CFG_TTHREADS:
if ( slapMode & SLAP_TOOL_MODE )
ldap_pvt_thread_pool_maxthreads(&connection_pool, c->value_int);
......
......@@ -59,7 +59,8 @@ BerVarray default_referral = NULL;
* global variables that need mutex protection
*/
ldap_pvt_thread_pool_t connection_pool;
int connection_pool_max = SLAP_MAX_WORKER_THREADS;
int connection_pool_max = SLAP_MAX_WORKER_THREADS;
int connection_pool_queues = 1;
int slap_tool_thread_max = 1;
slap_counters_t slap_counters, *slap_counters_list;
......@@ -135,8 +136,8 @@ slap_init( int mode, const char *name )
slap_name = name;
ldap_pvt_thread_pool_init( &connection_pool,
connection_pool_max, 0);
ldap_pvt_thread_pool_init_q( &connection_pool,
connection_pool_max, 0, 4);
slap_counters_init( &slap_counters );
......
......@@ -2066,6 +2066,7 @@ LDAP_SLAPD_V (time_t) starttime;
LDAP_SLAPD_V (ldap_pvt_thread_pool_t) connection_pool;
LDAP_SLAPD_V (int) connection_pool_max;
LDAP_SLAPD_V (int) connection_pool_queues;
LDAP_SLAPD_V (int) slap_tool_thread_max;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) entry2str_mutex;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment