Commit 082e9783 authored by Yann Ylavic's avatar Yann Ylavic
Browse files

Merge r1822849, r1822858, r1822878, r1822879, r1822883, r1828485, r1828493 from trunk:

* When mod_http2 is loaded more then ThreadsPerChild backend connections can
  be useful as mod_http2 has an additional thread pool on top of
  ThreadsPerChild.
  But leave the default with ThreadsPerChild.


* Add some some comment why we do not limit hmax any longer


mod_proxy: follow up to r1822849.

Get the help(er) of mod_http2 to determine how much connections should
be handled in the reslist by default (i.e. max_threads).


mod_proxy: follow up to r1822849 and r1822878.

Does r1822878's "static" APR_RETRIEVE_OPTIONAL_FN work if, say, mod_proxy is
builtin but mod_http2 isn't?

Not worth taking the risk here since it's not a fast path...

Note: if this is an issue, I'm afraid it applies elsewhere too.


mod_proxy: follow up to r1822849 and r1822879.

Fix my maths, thanks Stefan and Rüdiger!


needs mod_http2.h


* Add missing CHANGES entry for revisions 1822849,1822858,1822878,1822879,1822883,1828485


Submitted by: rpluem, ylavic, ylavic, ylavic, gsmith, rpluem
Reviewed by: rpluem, jim, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1832485 13f79535-47bb-0310-9956-ffa450edef68
parent eddd238e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.4.34

  *) mod_proxy: Do not restrict the maximum pool size for backend connections
     any longer by the maximum number of threads per process and use a better
     default if mod_http2 is loaded.
     [Yann Ylavic, Ruediger Pluem, Stefan Eissing, Gregg Smith]

  *) core: Preserve the original HTTP request method in the '%<m' LogFormat
     when an path-based ErrorDocument is used.  PR 62186. 
     [Micha Lenk <micha lenk.info>]
+24 −0
Original line number Diff line number Diff line
@@ -604,6 +604,30 @@ static const char *h2_conf_set_early_hints(cmd_parms *parms,
    return "value must be On or Off";
}

void h2_get_num_workers(server_rec *s, int *minw, int *maxw)
{
    int threads_per_child = 0;
    const h2_config *config = h2_config_sget(s);

    *minw = h2_config_geti(config, H2_CONF_MIN_WORKERS);
    *maxw = h2_config_geti(config, H2_CONF_MAX_WORKERS);    
    ap_mpm_query(AP_MPMQ_MAX_THREADS, &threads_per_child);

    if (*minw <= 0) {
        *minw = threads_per_child;
    }
    if (*maxw <= 0) {
        /* As a default, this seems to work quite well under mpm_event. 
         * For people enabling http2 under mpm_prefork, start 4 threads unless 
         * configured otherwise. People get unhappy if their http2 requests are 
         * blocking each other. */
        *maxw = 3 * (*minw) / 2;
        if (*maxw < 4) {
            *maxw = 4;
        }
    }
}

#define AP_END_CMD     AP_INIT_TAKE1(NULL, NULL, NULL, RSRC_CONF, NULL)

const command_rec h2_cmds[] = {
+2 −0
Original line number Diff line number Diff line
@@ -95,6 +95,8 @@ const h2_config *h2_config_rget(request_rec *r);
int h2_config_geti(const h2_config *conf, h2_config_var_t var);
apr_int64_t h2_config_geti64(const h2_config *conf, h2_config_var_t var);

void h2_get_num_workers(server_rec *s, int *minw, int *maxw);

void h2_config_init(apr_pool_t *pool);

const struct h2_priority *h2_config_get_priority(const h2_config *conf, 
+1 −12
Original line number Diff line number Diff line
@@ -127,18 +127,7 @@ apr_status_t h2_conn_child_init(apr_pool_t *pool, server_rec *s)

    h2_config_init(pool);
    
    minw = h2_config_geti(config, H2_CONF_MIN_WORKERS);
    maxw = h2_config_geti(config, H2_CONF_MAX_WORKERS);    
    if (minw <= 0) {
        minw = max_threads_per_child;
    }
    if (maxw <= 0) {
        /* As a default, this seems to work quite well under mpm_event. 
         * For people enabling http2 under mpm_prefork, start 4 threads unless 
         * configured otherwise. People get unhappy if their http2 requests are 
         * blocking each other. */
        maxw = H2MAX(3 * minw / 2, 4);
    }
    h2_get_num_workers(s, &minw, &maxw);
    
    idle_secs = h2_config_geti(config, H2_CONF_MAX_WORKER_IDLE_SECS);
    ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, s,
+6 −0
Original line number Diff line number Diff line
@@ -193,6 +193,11 @@ static void http2_req_engine_done(h2_req_engine *ngn, conn_rec *r_conn,
    h2_mplx_req_engine_done(ngn, r_conn, status);
}

static void http2_get_num_workers(server_rec *s, int *minw, int *maxw)
{
    h2_get_num_workers(s, minw, maxw);
}

/* Runs once per created child process. Perform any process 
 * related initionalization here.
 */
@@ -218,6 +223,7 @@ static void h2_hooks(apr_pool_t *pool)
    APR_REGISTER_OPTIONAL_FN(http2_req_engine_push);
    APR_REGISTER_OPTIONAL_FN(http2_req_engine_pull);
    APR_REGISTER_OPTIONAL_FN(http2_req_engine_done);
    APR_REGISTER_OPTIONAL_FN(http2_get_num_workers);

    ap_log_perror(APLOG_MARK, APLOG_TRACE1, 0, pool, "installing hooks");
    
Loading