You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2016/04/02 00:18:58 UTC

svn commit: r1737447 - in /httpd/httpd/trunk: CHANGES server/mpm/event/event.c server/mpm/worker/worker.c

Author: ylavic
Date: Fri Apr  1 22:18:58 2016
New Revision: 1737447

URL: http://svn.apache.org/viewvc?rev=1737447&view=rev
Log:
mpm_event, mpm_worker: Fix computation of MinSpareThreads' lower bound
according the number of listeners buckets.

We want the number of children processes to be a multiple of the number of
buckets so to optimally accept connections (the system will distribute them
accross all the buckets/listeners anyway, thus children must follow).

For MinSpareThreads, this means that we need neither more nor less than one
thread above 'threads_per_child * (num_buckets - 1)' to achieve this, since
each created child adds threads_per_child workers.

Actually, given that perform_idle_server_maintenance() is called per bucket,
and hence checks 'threads_per_child / num_buckets' for one bucket, let's lower
bound MinSpareThreads to 'threads_per_child * (num_buckets - 1) + num_buckets'.

Previously we used 'threads_per_child * num_buckets' which caused one spurious
child to be created from the very first busy worker thread of each newly added
child.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm/worker/worker.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1737447&r1=1737446&r2=1737447&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Apr  1 22:18:58 2016
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mpm_event, mpm_worker: Fix computation of MinSpareThreads' lower bound
+     according the number of listeners buckets.  [Yann Ylavic]
+
   *) mod_proxy_http2: using HTTP/2 flow control for backend streams by 
      observing data actually send out on the frontend h2 connection. 
      [Stefan Eissing]

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1737447&r1=1737446&r2=1737447&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Fri Apr  1 22:18:58 2016
@@ -3090,8 +3090,8 @@ static int event_run(apr_pool_t * _pconf
         ap_daemons_limit = num_buckets;
     if (ap_daemons_to_start < num_buckets)
         ap_daemons_to_start = num_buckets;
-    if (min_spare_threads < threads_per_child * num_buckets)
-        min_spare_threads = threads_per_child * num_buckets;
+    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;
 

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1737447&r1=1737446&r2=1737447&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Fri Apr  1 22:18:58 2016
@@ -1833,8 +1833,8 @@ static int worker_run(apr_pool_t *_pconf
         ap_daemons_limit = num_buckets;
     if (ap_daemons_to_start < num_buckets)
         ap_daemons_to_start = num_buckets;
-    if (min_spare_threads < threads_per_child * num_buckets)
-        min_spare_threads = threads_per_child * num_buckets;
+    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;