From: Yann Ylavic Date: Fri, 1 Apr 2016 22:18:58 +0000 (+0000) Subject: mpm_event, mpm_worker: Fix computation of MinSpareThreads' lower bound X-Git-Tag: 2.5.0-alpha~1795 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=59d1e2aa8ef99e0003e23ed2e0d7f8090b74e9b6;p=thirdparty%2Fapache%2Fhttpd.git 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1737447 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 5f93055e993..480941c61ab 100644 --- a/CHANGES +++ b/CHANGES @@ -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] diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 6648331661d..93760606632 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -3090,8 +3090,8 @@ 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; - 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; diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 5cb516f9c22..dc61adce05d 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -1833,8 +1833,8 @@ 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; - 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;