Commit a2f06f0e authored by Stefan Eissing's avatar Stefan Eissing
Browse files

On the trunk:

mod_http2: checking for required nghttp2 features to enabled dynamic input window resizing for streams (nghttp2 >= v1.5.0). Reporting as feature DWINS on startup.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1789279 13f79535-47bb-0310-9956-ffa450edef68
parent 2afdc4b8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ Changes with Apache 2.5.0
     descriptors on graceful restart.  [Yann Ylavic]

  *) mod_http2: input buffering and dynamic flow windows for increased 
     throughput. [Stefan Eissing]
     throughput. Requires nghttp2 >= v1.5.0 features. Announced at startup
     in mod_http2 INFO log as feature 'DWINS'. [Stefan Eissing]

  *) mod_http2: h2 workers with improved scalability for better scheduling
     performance. There are H2MaxWorkers threads created at start and the
+3 −0
Original line number Diff line number Diff line
@@ -155,6 +155,9 @@ dnl # nghttp2 >= 1.5.0: changing stream priorities
dnl # nghttp2 >= 1.14.0: invalid header callback
      AC_CHECK_FUNCS([nghttp2_session_callbacks_set_on_invalid_header_callback], 
        [APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_INVALID_HEADER_CB"])], [])
dnl # nghttp2 >= 1.15.0: get/set stream window sizes
      AC_CHECK_FUNCS([nghttp2_session_get_stream_local_window_size], 
        [APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_LOCAL_WIN_SIZE"])], [])
    else
      AC_MSG_WARN([nghttp2 version is too old])
    fi
+5 −2
Original line number Diff line number Diff line
@@ -80,9 +80,9 @@ static h2_stream *get_stream(h2_session *session, int stream_id)
static void update_window(void *ctx, int stream_id, apr_off_t bytes_read)
{
    h2_session *session = ctx;
    h2_stream *stream;
    
    if (bytes_read > 0) {
        h2_stream *stream = get_stream(session, stream_id);
        apr_off_t consumed = bytes_read;
        
        while (consumed > 0) {
@@ -91,7 +91,9 @@ static void update_window(void *ctx, int stream_id, apr_off_t bytes_read)
            consumed -= len;
        }

        if (stream) {
        (void)stream;
#ifdef H2_NG2_LOCAL_WIN_SIZE
        if ((stream = get_stream(session, stream_id))) {
            int cur_size = nghttp2_session_get_stream_local_window_size(
                session->ngh2, stream->id);
            int win = stream->in_window_size;
@@ -133,6 +135,7 @@ static void update_window(void *ctx, int stream_id, apr_off_t bytes_read)
                          session->id, stream_id, (long)bytes_read, 
                          cur_size, stream->in_window_size);
        }
#endif
    }
}

+3 −1
Original line number Diff line number Diff line
@@ -534,9 +534,11 @@ h2_stream *h2_stream_create(int id, apr_pool_t *pool, h2_session *session,
    h2_beam_create(&stream->output, pool, id, "output", H2_BEAM_OWNER_RECV, 0,
                   session->s->timeout);
               
#ifdef H2_NG2_LOCAL_WIN_SIZE
    stream->in_window_size = 
        nghttp2_session_get_stream_local_window_size(
            stream->session->ngh2, stream->id);
#endif

    ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, 
                  H2_STRM_LOG(APLOGNO(03082), stream, "created"));
+6 −1
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ typedef struct {
    unsigned int change_prio : 1;
    unsigned int sha256 : 1;
    unsigned int inv_headers : 1;
    unsigned int dyn_windows : 1;
} features;

static features myfeats;
@@ -96,6 +97,9 @@ static int h2_post_config(apr_pool_t *p, apr_pool_t *plog,
#ifdef H2_NG2_INVALID_HEADER_CB
    myfeats.inv_headers = 1;
#endif
#ifdef H2_NG2_LOCAL_WIN_SIZE
    myfeats.dyn_windows = 1;
#endif
    
    apr_pool_userdata_get(&data, mod_h2_init_key, s->process->pool);
    if ( data == NULL ) {
@@ -108,11 +112,12 @@ static int h2_post_config(apr_pool_t *p, apr_pool_t *plog,
    
    ngh2 = nghttp2_version(0);
    ap_log_error( APLOG_MARK, APLOG_INFO, 0, s, APLOGNO(03090)
                 "mod_http2 (v%s, feats=%s%s%s, nghttp2 %s), initializing...",
                 "mod_http2 (v%s, feats=%s%s%s%s, nghttp2 %s), initializing...",
                 MOD_HTTP2_VERSION, 
                 myfeats.change_prio? "CHPRIO"  : "", 
                 myfeats.sha256?      "+SHA256" : "",
                 myfeats.inv_headers? "+INVHD"  : "",
                 myfeats.dyn_windows? "+DWINS"  : "",
                 ngh2?                ngh2->version_str : "unknown");
    
    switch (h2_conn_mpm_type()) {