From d3792903cfa2f2de282aace47a442b26d5e86c00 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Tue, 2 Jan 2018 15:44:17 +0000 Subject: [PATCH] mpm_event: worker factor vs pollset. 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 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 2d71f923192..8ff72d1996a 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -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; } -- 2.47.3