You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2017/03/29 07:04:07 UTC

svn commit: r1789279 - in /httpd/httpd/trunk: CHANGES modules/http2/config2.m4 modules/http2/h2_session.c modules/http2/h2_stream.c modules/http2/mod_http2.c

Author: icing
Date: Wed Mar 29 07:04:07 2017
New Revision: 1789279

URL: http://svn.apache.org/viewvc?rev=1789279&view=rev
Log:
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.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/http2/config2.m4
    httpd/httpd/trunk/modules/http2/h2_session.c
    httpd/httpd/trunk/modules/http2/h2_stream.c
    httpd/httpd/trunk/modules/http2/mod_http2.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1789279&r1=1789278&r2=1789279&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Mar 29 07:04:07 2017
@@ -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

Modified: httpd/httpd/trunk/modules/http2/config2.m4
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/config2.m4?rev=1789279&r1=1789278&r2=1789279&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/config2.m4 (original)
+++ httpd/httpd/trunk/modules/http2/config2.m4 Wed Mar 29 07:04:07 2017
@@ -155,6 +155,9 @@ dnl # nghttp2 >= 1.5.0: changing stream
 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

Modified: httpd/httpd/trunk/modules/http2/h2_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.c?rev=1789279&r1=1789278&r2=1789279&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_session.c Wed Mar 29 07:04:07 2017
@@ -80,9 +80,9 @@ static h2_stream *get_stream(h2_session
 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
             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
                           session->id, stream_id, (long)bytes_read, 
                           cur_size, stream->in_window_size);
         }
+#endif
     }
 }
 

Modified: httpd/httpd/trunk/modules/http2/h2_stream.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_stream.c?rev=1789279&r1=1789278&r2=1789279&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_stream.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_stream.c Wed Mar 29 07:04:07 2017
@@ -533,10 +533,12 @@ h2_stream *h2_stream_create(int id, apr_
     
     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"));

Modified: httpd/httpd/trunk/modules/http2/mod_http2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/mod_http2.c?rev=1789279&r1=1789278&r2=1789279&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/mod_http2.c (original)
+++ httpd/httpd/trunk/modules/http2/mod_http2.c Wed Mar 29 07:04:07 2017
@@ -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,
 #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,
     
     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()) {