summaryrefslogtreecommitdiffstats
path: root/server/mpm/worker/worker.c
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2016-06-25 20:56:28 +0200
committerYann Ylavic <ylavic@apache.org>2016-06-25 20:56:28 +0200
commit7932f3c76b053cb5ab90adaa38812c1a23ec6f7f (patch)
tree06e73633c53c19175d4eb4c3fc63ffa120dc9169 /server/mpm/worker/worker.c
parentRebuild. (diff)
downloadapache2-7932f3c76b053cb5ab90adaa38812c1a23ec6f7f.tar.xz
apache2-7932f3c76b053cb5ab90adaa38812c1a23ec6f7f.zip
Follow up to r1737447: fix max_spare_threads lower bound.
Suggested by: Rick Houser <rick.houser jackson.com> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1750218 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--server/mpm/worker/worker.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c
index 9c49d832cc..d5846d768e 100644
--- a/server/mpm/worker/worker.c
+++ b/server/mpm/worker/worker.c
@@ -1838,10 +1838,16 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
ap_daemons_limit = num_buckets;
if (ap_daemons_to_start < num_buckets)
ap_daemons_to_start = num_buckets;
+ /* We want to create as much children at a time as the number of buckets,
+ * so to optimally accept connections (evenly distributed accross buckets).
+ * Thus min_spare_threads should at least maintain num_buckets children,
+ * and max_spare_threads allow num_buckets more children w/o triggering
+ * immediately (e.g. num_buckets idle threads margin, one per bucket).
+ */
if (min_spare_threads < threads_per_child * (num_buckets - 1) + num_buckets)
min_spare_threads = threads_per_child * (num_buckets - 1) + num_buckets;
- if (max_spare_threads < min_spare_threads + threads_per_child * num_buckets)
- max_spare_threads = min_spare_threads + threads_per_child * num_buckets;
+ if (max_spare_threads < min_spare_threads + (threads_per_child + 1) * num_buckets)
+ max_spare_threads = min_spare_threads + (threads_per_child + 1) * num_buckets;
/* If we're doing a graceful_restart then we're going to see a lot
* of children exiting immediately when we get into the main loop