]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mpm_event: worker factor vs pollset.
authorYann Ylavic <ylavic@apache.org>
Tue, 2 Jan 2018 15:44:17 +0000 (15:44 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 2 Jan 2018 15:44:17 +0000 (15:44 +0000)
Make sure the worker factor is at least one (w.r.t. WORKER_FACTOR_SCALE), and
use it to size the pollset appropriately (including K-A and lingering close
connections), in addition to the listening sockets.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1819852 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/event/event.c

index 2d71f923192e53e827e95e608fca44c9928e2bf7..8ff72d1996a25d18f9abaee1701fa8d6a5e24b0f 100644 (file)
@@ -2413,9 +2413,14 @@ static void *APR_THREAD_FUNC start_threads(apr_thread_t * thd, void *dummy)
     int loops;
     int prev_threads_created;
     int max_recycled_pools = -1;
-    int good_methods[] = {APR_POLLSET_KQUEUE, APR_POLLSET_PORT, APR_POLLSET_EPOLL};
-    /* XXX don't we need more to handle K-A or lingering close? */
-    const apr_uint32_t pollset_size = threads_per_child * 2;
+    const int good_methods[] = { APR_POLLSET_KQUEUE,
+                                 APR_POLLSET_PORT,
+                                 APR_POLLSET_EPOLL };
+    /* XXX: K-A or lingering close connection included in the async factor */
+    const apr_uint32_t async_factor = worker_factor / WORKER_FACTOR_SCALE;
+    const apr_uint32_t pollset_size = (apr_uint32_t)num_listensocks +
+                                      (apr_uint32_t)threads_per_child *
+                                      (async_factor > 2 ? async_factor : 2);
 
     /* We must create the fd queues before we start up the listener
      * and worker threads. */
@@ -4035,8 +4040,9 @@ static const char *set_worker_factor(cmd_parms * cmd, void *dummy,
         return "AsyncRequestWorkerFactor argument must be a positive number";
 
     worker_factor = val * WORKER_FACTOR_SCALE;
-    if (worker_factor == 0)
-        worker_factor = 1;
+    if (worker_factor < WORKER_FACTOR_SCALE) {
+        worker_factor = WORKER_FACTOR_SCALE;
+    }
     return NULL;
 }