]> granicus.if.org Git - apache/commitdiff
On the trunk:
authorStefan Eissing <icing@apache.org>
Wed, 29 Mar 2017 07:04:07 +0000 (07:04 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 29 Mar 2017 07:04:07 +0000 (07:04 +0000)
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

CHANGES
modules/http2/config2.m4
modules/http2/h2_session.c
modules/http2/h2_stream.c
modules/http2/mod_http2.c

diff --git a/CHANGES b/CHANGES
index 6576d4a6b5bcfe575eb72ce4da990a2ee634f644..f99ca450bf976df694528ebcc94b87a0229b4042 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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
index 26f71632a0038bb32c16dc78d7c9d4e110ac1ab3..fac130b2195bedc5fa14550ef289638192ecca78 100644 (file)
@@ -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
index d05d998e108d633dbdd26ea8c10d01e06b837ebf..78180b4c036833db9a9807d61d7b24ceaa01fce6 100644 (file)
@@ -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
     }
 }
 
index 835bf238ff2aa444e3575a4d33b23bb1e58bec54..9af2f29edc113db0f37317aa7a3033b317a05255 100644 (file)
@@ -533,10 +533,12 @@ 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"));
index e0a4b908832d8d0571cfd183e206b499fb33a368..ea399c91a28d5a273330d5a36d939415e9ad57ad 100644 (file)
@@ -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()) {