]> granicus.if.org Git - apache/commitdiff
Merge r1750218 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 28 Jun 2016 11:46:34 +0000 (11:46 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 28 Jun 2016 11:46:34 +0000 (11:46 +0000)
Follow up to r1737447: fix max_spare_threads lower bound.
Suggested by: Rick Houser <rick.houser jackson.com>

Submitted by: ylavic
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1750488 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/mpm/event/event.c
server/mpm/worker/worker.c

diff --git a/STATUS b/STATUS
index 0aed659f722c7582d4871260618a7892260d9551..1afcbbeeaf9339fb7ef935dee43607634921be50 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -116,11 +116,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mpm_event/worker: fix MaxSpareThreads lower bound (follow up to /
-     consistent with MinSpareThreads' change in r1748336 from 2.4.21)
-     trunk patch: http://svn.apache.org/r1750218
-     2.4.x: trunk works
-     +1: ylavic, rpluem, jim
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index 89ee47671d954b5bd51d0c7588b3df9bb7f416cd..baeb5a76eb2c593376cd19b0243f1023eac7745a 100644 (file)
@@ -2829,10 +2829,16 @@ static int event_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
index d15ffa207cc4d7b0085f92439e614559da0ade2a..d0ed6040630b1a93a3738af42f41094e6f96f76e 100644 (file)
@@ -1836,10 +1836,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