diff options
author | Stefan Fritsch <sf@apache.org> | 2011-06-20 21:00:52 +0200 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2011-06-20 21:00:52 +0200 |
commit | 6d8de2ff429c61103aeae1e7c486380627969f9d (patch) | |
tree | f33216b84b1d459424fecfd615657f3eda1ba016 /server/mpm | |
parent | rotatelogs: Add support for running a custom program after a log (diff) | |
download | apache2-6d8de2ff429c61103aeae1e7c486380627969f9d.tar.xz apache2-6d8de2ff429c61103aeae1e7c486380627969f9d.zip |
Rename MaxClients to MaxRequestWorkers which describes more accurately what
it does.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1137744 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/mpm')
-rw-r--r-- | server/mpm/event/event.c | 82 | ||||
-rw-r--r-- | server/mpm/mpmt_os2/mpmt_os2.c | 2 | ||||
-rw-r--r-- | server/mpm/netware/mpm_netware.c | 6 | ||||
-rw-r--r-- | server/mpm/prefork/prefork.c | 28 | ||||
-rw-r--r-- | server/mpm/worker/worker.c | 84 |
5 files changed, 109 insertions, 93 deletions
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 432ba81fbc..03fef9a2fc 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -162,7 +162,7 @@ static int ap_daemons_to_start = 0; static int min_spare_threads = 0; static int max_spare_threads = 0; static int ap_daemons_limit = 0; -static int max_clients = 0; +static int max_workers = 0; static int server_limit = 0; static int thread_limit = 0; static int dying = 0; @@ -271,8 +271,8 @@ typedef struct event_retained_data { int maxclients_reported; /* * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We - * use this value to optimize routines that have to scan the entire + * to deal with MaxRequestWorkers changes across AP_SIG_GRACEFUL restarts. + * We use this value to optimize routines that have to scan the entire * scoreboard. */ int max_daemons_limit; @@ -2370,17 +2370,16 @@ static void perform_idle_server_maintenance(void) if (active_thread_count >= ap_daemons_limit * threads_per_child) { if (!retained->maxclients_reported) { /* only report this condition once */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, - ap_server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, + "server reached MaxRequestWorkers setting, " + "consider raising the MaxRequestWorkers " + "setting"); retained->maxclients_reported = 1; } } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, - ap_server_conf, - "scoreboard is full, not at MaxClients"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, + "scoreboard is full, not at MaxRequestWorkers"); } retained->idle_spawn_rate = 1; } @@ -2389,8 +2388,7 @@ static void perform_idle_server_maintenance(void) free_length = retained->idle_spawn_rate; } if (retained->idle_spawn_rate >= 8) { - ap_log_error(APLOG_MARK, APLOG_INFO, 0, - ap_server_conf, + ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf, "server seems busy, (you may need " "to increase StartServers, ThreadsPerChild " "or Min/MaxSpareThreads), " @@ -2781,7 +2779,7 @@ static int event_pre_config(apr_pool_t * pconf, apr_pool_t * plog, thread_limit = DEFAULT_THREAD_LIMIT; ap_daemons_limit = server_limit; threads_per_child = DEFAULT_THREADS_PER_CHILD; - max_clients = ap_daemons_limit * threads_per_child; + max_workers = ap_daemons_limit * threads_per_child; ap_extended_status = 0; return OK; @@ -2917,57 +2915,57 @@ static int event_check_config(apr_pool_t *p, apr_pool_t *plog, threads_per_child = 1; } - if (max_clients < threads_per_child) { + if (max_workers < threads_per_child) { if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d is less than " - "ThreadsPerChild of", max_clients); + "WARNING: MaxRequestWorkers of %d is less than " + "ThreadsPerChild of", max_workers); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - " %d, increasing to %d. MaxClients must be at " + " %d, increasing to %d. MaxRequestWorkers must be at " "least as large", threads_per_child, threads_per_child); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " as the number of threads in a single server."); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d is less than ThreadsPerChild " + "MaxRequestWorkers of %d is less than ThreadsPerChild " "of %d, increasing to match", - max_clients, threads_per_child); + max_workers, threads_per_child); } - max_clients = threads_per_child; + max_workers = threads_per_child; } - ap_daemons_limit = max_clients / threads_per_child; + ap_daemons_limit = max_workers / threads_per_child; - if (max_clients % threads_per_child) { - int tmp_max_clients = ap_daemons_limit * threads_per_child; + if (max_workers % threads_per_child) { + int tmp_max_workers = ap_daemons_limit * threads_per_child; if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d is not an integer " - "multiple of", max_clients); + "WARNING: MaxRequestWorkers of %d is not an integer " + "multiple of", max_workers); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " ThreadsPerChild of %d, decreasing to nearest " "multiple %d,", threads_per_child, - tmp_max_clients); + tmp_max_workers); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " for a maximum of %d servers.", ap_daemons_limit); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d is not an integer multiple of " - "ThreadsPerChild of %d, decreasing to nearest " - "multiple %d", max_clients, threads_per_child, - tmp_max_clients); + "MaxRequestWorkers of %d is not an integer multiple " + "of ThreadsPerChild of %d, decreasing to nearest " + "multiple %d", max_workers, threads_per_child, + tmp_max_workers); } - max_clients = tmp_max_clients; + max_workers = tmp_max_workers; } if (ap_daemons_limit > server_limit) { if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d would require %d " - "servers and ", max_clients, ap_daemons_limit); + "WARNING: MaxRequestWorkers of %d would require %d " + "servers and ", max_workers, ap_daemons_limit); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " would exceed ServerLimit of %d, decreasing to %d.", server_limit, server_limit * threads_per_child); @@ -2976,9 +2974,9 @@ static int event_check_config(apr_pool_t *p, apr_pool_t *plog, "directive."); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d would require %d servers and " + "MaxRequestWorkers of %d would require %d servers and " "exceed ServerLimit of %d, decreasing to %d", - max_clients, ap_daemons_limit, server_limit, + max_workers, ap_daemons_limit, server_limit, server_limit * threads_per_child); } ap_daemons_limit = server_limit; @@ -3080,15 +3078,19 @@ static const char *set_max_spare_threads(cmd_parms * cmd, void *dummy, return NULL; } -static const char *set_max_clients(cmd_parms * cmd, void *dummy, +static const char *set_max_workers(cmd_parms * cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } - - max_clients = atoi(arg); + if (!strcasecmp(cmd->cmd->name, "MaxRequestWorkers")) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, + "MaxClients is deprecated, use MaxRequestWorkers " + "instead."); + } + max_workers = atoi(arg); return NULL; } @@ -3136,7 +3138,9 @@ static const command_rec event_cmds[] = { "Minimum number of idle threads, to handle request spikes"), AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF, "Maximum number of idle threads"), - AP_INIT_TAKE1("MaxClients", set_max_clients, NULL, RSRC_CONF, + AP_INIT_TAKE1("MaxClients", set_max_workers, NULL, RSRC_CONF, + "Deprecated name of MaxRequestWorkers"), + AP_INIT_TAKE1("MaxRequestWorkers", set_max_workers, NULL, RSRC_CONF, "Maximum number of threads alive at the same time"), AP_INIT_TAKE1("ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, "Number of threads each child creates"), diff --git a/server/mpm/mpmt_os2/mpmt_os2.c b/server/mpm/mpmt_os2/mpmt_os2.c index 46d80f6172..10362dfefe 100644 --- a/server/mpm/mpmt_os2/mpmt_os2.c +++ b/server/mpm/mpmt_os2/mpmt_os2.c @@ -34,7 +34,7 @@ /* Todo list - - Enforce MaxClients somehow + - Enforce MaxRequestWorkers somehow */ #define INCL_NOPMAPI #define INCL_DOS diff --git a/server/mpm/netware/mpm_netware.c b/server/mpm/netware/mpm_netware.c index 183d5555c5..1f3ee97d53 100644 --- a/server/mpm/netware/mpm_netware.c +++ b/server/mpm/netware/mpm_netware.c @@ -121,7 +121,7 @@ static int mpm_state = AP_MPMQ_STARTING; /* * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across SIGWINCH restarts. We use this + * to deal with MaxRequestWorkers changes across SIGWINCH restarts. We use this * value to optimize routines that have to scan the entire scoreboard. */ static int ap_max_workers_limit = -1; @@ -681,8 +681,8 @@ static void perform_idle_server_maintenance(apr_pool_t *p) if (!reported) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); + "server reached MaxRequestWorkers setting, consider" + " raising the MaxRequestWorkers setting"); reported = 1; } idle_spawn_rate = 1; diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 61d5cc70cc..911bd647be 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -90,7 +90,7 @@ static apr_proc_mutex_t *accept_mutex; static int ap_daemons_to_start=0; static int ap_daemons_min_free=0; static int ap_daemons_max_free=0; -static int ap_daemons_limit=0; /* MaxClients */ +static int ap_daemons_limit=0; /* MaxRequestWorkers */ static int server_limit = 0; static int mpm_state = AP_MPMQ_STARTING; static ap_pod_t *pod; @@ -107,7 +107,7 @@ typedef struct prefork_retained_data { int maxclients_reported; /* * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We + * to deal with MaxRequestWorkers changes across AP_SIG_GRACEFUL restarts. We * use this value to optimize routines that have to scan the entire scoreboard. */ int max_daemons_limit; @@ -876,8 +876,8 @@ static void perform_idle_server_maintenance(apr_pool_t *p) /* only report this condition once */ if (!retained->maxclients_reported) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); + "server reached MaxRequestWorkers setting, consider" + " raising the MaxRequestWorkers setting"); retained->maxclients_reported = 1; } retained->idle_spawn_rate = 1; @@ -1355,17 +1355,17 @@ static int prefork_check_config(apr_pool_t *p, apr_pool_t *plog, if (ap_daemons_limit > server_limit) { if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d exceeds ServerLimit " + "WARNING: MaxRequestWorkers of %d exceeds ServerLimit " "value of", ap_daemons_limit); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - " %d servers, decreasing MaxClients to %d.", + " %d servers, decreasing MaxRequestWorkers to %d.", server_limit, server_limit); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " To increase, please see the ServerLimit " "directive."); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d exceeds ServerLimit value " + "MaxRequestWorkers of %d exceeds ServerLimit value " "of %d, decreasing to match", ap_daemons_limit, server_limit); } @@ -1374,11 +1374,11 @@ static int prefork_check_config(apr_pool_t *p, apr_pool_t *plog, else if (ap_daemons_limit < 1) { if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d not allowed, " + "WARNING: MaxRequestWorkers of %d not allowed, " "increasing to 1.", ap_daemons_limit); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d not allowed, increasing to 1", + "MaxRequestWorkers of %d not allowed, increasing to 1", ap_daemons_limit); } ap_daemons_limit = 1; @@ -1478,7 +1478,11 @@ static const char *set_max_clients (cmd_parms *cmd, void *dummy, const char *arg if (err != NULL) { return err; } - + if (!strcasecmp(cmd->cmd->name, "MaxRequestWorkers")) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, + "MaxClients is deprecated, use MaxRequestWorkers " + "instead."); + } ap_daemons_limit = atoi(arg); return NULL; } @@ -1503,9 +1507,11 @@ AP_INIT_TAKE1("MinSpareServers", set_min_free_servers, NULL, RSRC_CONF, AP_INIT_TAKE1("MaxSpareServers", set_max_free_servers, NULL, RSRC_CONF, "Maximum number of idle children"), AP_INIT_TAKE1("MaxClients", set_max_clients, NULL, RSRC_CONF, + "Deprecated name of MaxRequestWorkers"), +AP_INIT_TAKE1("MaxRequestWorkers", set_max_clients, NULL, RSRC_CONF, "Maximum number of children alive at the same time"), AP_INIT_TAKE1("ServerLimit", set_server_limit, NULL, RSRC_CONF, - "Maximum value of MaxClients for this run of Apache"), + "Maximum value of MaxRequestWorkers for this run of Apache"), AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND, { NULL } }; diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 752679d458..9d0971cf65 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -119,7 +119,7 @@ static int ap_daemons_to_start = 0; static int min_spare_threads = 0; static int max_spare_threads = 0; static int ap_daemons_limit = 0; -static int max_clients = 0; +static int max_workers = 0; static int server_limit = 0; static int thread_limit = 0; static int dying = 0; @@ -148,8 +148,8 @@ typedef struct worker_retained_data { int near_maxclients_reported; /* * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We - * use this value to optimize routines that have to scan the entire + * to deal with MaxRequestWorkers changes across AP_SIG_GRACEFUL restarts. + * We use this value to optimize routines that have to scan the entire * scoreboard. */ int max_daemons_limit; @@ -1584,22 +1584,22 @@ static void perform_idle_server_maintenance(void) if (active_thread_count >= ap_daemons_limit * threads_per_child) { /* no threads are "inactive" - starting, stopping, etc. */ - /* have we reached MaxClients, or just getting close? */ + /* have we reached MaxRequestWorkers, or just getting close? */ if (0 == idle_thread_count) { if (!retained->maxclients_reported) { /* only report this condition once */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, - ap_server_conf, - "server reached MaxClients setting, consider" - " raising the MaxClients setting"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, + "server reached MaxRequestWorkers " + "setting, consider raising the " + "MaxRequestWorkers setting"); retained->maxclients_reported = 1; } } else { if (!retained->near_maxclients_reported) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, - ap_server_conf, - "server is within MinSpareThreads of MaxClients, " - "consider raising the MaxClients setting"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, + "server is within MinSpareThreads of " + "MaxRequestWorkers, consider raising the " + "MaxRequestWorkers setting"); retained->near_maxclients_reported = 1; } } @@ -1607,7 +1607,7 @@ static void perform_idle_server_maintenance(void) else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, - "scoreboard is full, not at MaxClients"); + "scoreboard is full, not at MaxRequestWorkers"); } retained->idle_spawn_rate = 1; } @@ -2007,7 +2007,7 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog, thread_limit = DEFAULT_THREAD_LIMIT; ap_daemons_limit = server_limit; threads_per_child = DEFAULT_THREADS_PER_CHILD; - max_clients = ap_daemons_limit * threads_per_child; + max_workers = ap_daemons_limit * threads_per_child; ap_extended_status = 0; return OK; @@ -2143,57 +2143,57 @@ static int worker_check_config(apr_pool_t *p, apr_pool_t *plog, threads_per_child = 1; } - if (max_clients < threads_per_child) { + if (max_workers < threads_per_child) { if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d is less than " - "ThreadsPerChild of", max_clients); + "WARNING: MaxRequestWorkers of %d is less than " + "ThreadsPerChild of", max_workers); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - " %d, increasing to %d. MaxClients must be at " + " %d, increasing to %d. MaxRequestWorkers must be at " "least as large", threads_per_child, threads_per_child); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " as the number of threads in a single server."); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d is less than ThreadsPerChild " + "MaxRequestWorkers of %d is less than ThreadsPerChild " "of %d, increasing to match", - max_clients, threads_per_child); + max_workers, threads_per_child); } - max_clients = threads_per_child; + max_workers = threads_per_child; } - ap_daemons_limit = max_clients / threads_per_child; + ap_daemons_limit = max_workers / threads_per_child; - if (max_clients % threads_per_child) { - int tmp_max_clients = ap_daemons_limit * threads_per_child; + if (max_workers % threads_per_child) { + int tmp_max_workers = ap_daemons_limit * threads_per_child; if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d is not an integer " - "multiple of", max_clients); + "WARNING: MaxRequestWorkers of %d is not an integer " + "multiple of", max_workers); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " ThreadsPerChild of %d, decreasing to nearest " "multiple %d,", threads_per_child, - tmp_max_clients); + tmp_max_workers); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " for a maximum of %d servers.", ap_daemons_limit); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d is not an integer multiple of " + "MaxRequestWorkers of %d is not an integer multiple of " "ThreadsPerChild of %d, decreasing to nearest " - "multiple %d", max_clients, threads_per_child, - tmp_max_clients); + "multiple %d", max_workers, threads_per_child, + tmp_max_workers); } - max_clients = tmp_max_clients; + max_workers = tmp_max_workers; } if (ap_daemons_limit > server_limit) { if (startup) { ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, - "WARNING: MaxClients of %d would require %d " - "servers and ", max_clients, ap_daemons_limit); + "WARNING: MaxRequestWorkers of %d would require %d " + "servers and ", max_workers, ap_daemons_limit); ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL, " would exceed ServerLimit of %d, decreasing to %d.", server_limit, server_limit * threads_per_child); @@ -2202,9 +2202,9 @@ static int worker_check_config(apr_pool_t *p, apr_pool_t *plog, "directive."); } else { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "MaxClients of %d would require %d servers and " + "MaxRequestWorkers of %d would require %d servers and " "exceed ServerLimit of %d, decreasing to %d", - max_clients, ap_daemons_limit, server_limit, + max_workers, ap_daemons_limit, server_limit, server_limit * threads_per_child); } ap_daemons_limit = server_limit; @@ -2304,15 +2304,19 @@ static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, return NULL; } -static const char *set_max_clients (cmd_parms *cmd, void *dummy, +static const char *set_max_workers (cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } - - max_clients = atoi(arg); + if (!strcasecmp(cmd->cmd->name, "MaxRequestWorkers")) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, + "MaxClients is deprecated, use MaxRequestWorkers " + "instead."); + } + max_workers = atoi(arg); return NULL; } @@ -2358,8 +2362,10 @@ AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF, "Minimum number of idle threads, to handle request spikes"), AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF, "Maximum number of idle threads"), -AP_INIT_TAKE1("MaxClients", set_max_clients, NULL, RSRC_CONF, +AP_INIT_TAKE1("MaxRequestWorkers", set_max_workers, NULL, RSRC_CONF, "Maximum number of threads alive at the same time"), +AP_INIT_TAKE1("MaxClients", set_max_workers, NULL, RSRC_CONF, + "Deprecated name of MaxRequestWorkers"), AP_INIT_TAKE1("ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, "Number of threads each child creates"), AP_INIT_TAKE1("ServerLimit", set_server_limit, NULL, RSRC_CONF, |