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 2015/10/29 15:38:52 UTC
svn commit: r1711283 - in /httpd/httpd/trunk/modules/http2: h2_conn_io.c
h2_session.c
Author: icing
Date: Thu Oct 29 14:38:52 2015
New Revision: 1711283
URL: http://svn.apache.org/viewvc?rev=1711283&view=rev
Log:
some tuning of buffer/write record sizes
Modified:
httpd/httpd/trunk/modules/http2/h2_conn_io.c
httpd/httpd/trunk/modules/http2/h2_session.c
Modified: httpd/httpd/trunk/modules/http2/h2_conn_io.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn_io.c?rev=1711283&r1=1711282&r2=1711283&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn_io.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn_io.c Thu Oct 29 14:38:52 2015
@@ -28,16 +28,21 @@
#include "h2_h2.h"
#include "h2_util.h"
-#define WRITE_BUFFER_SIZE (128*1024)
+#define TLS_DATA_MAX (16*1024)
+
/* Calculated like this: assuming MTU 1500 bytes
* 1500 - 40 (IP) - 20 (TCP) - 40 (TCP options)
* - TLS overhead (60-100)
* ~= 1300 bytes */
#define WRITE_SIZE_INITIAL 1300
-/* Calculated like this: max TLS record size
- * 16*1024
- * - TLS overhead (60-100) */
-#define WRITE_SIZE_MAX (16*1024 - 100)
+/* Calculated like this: max TLS record size 16*1024
+ * - 40 (IP) - 20 (TCP) - 40 (TCP options)
+ * - TLS overhead (60-100)
+ * which seems to create less TCP packets overall
+ */
+#define WRITE_SIZE_MAX (TLS_DATA_MAX - 100)
+
+#define WRITE_BUFFER_SIZE (8*WRITE_SIZE_MAX)
apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c)
{
Modified: httpd/httpd/trunk/modules/http2/h2_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.c?rev=1711283&r1=1711282&r2=1711283&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_session.c Thu Oct 29 14:38:52 2015
@@ -594,6 +594,20 @@ static int on_send_data_cb(nghttp2_sessi
return h2_session_status_from_apr_status(status);
}
+static ssize_t on_data_source_read_length_cb(nghttp2_session *session,
+ uint8_t frame_type, int32_t stream_id,
+ int32_t session_remote_window_size,
+ int32_t stream_remote_window_size,
+ uint32_t remote_max_frame_size,
+ void *user_data)
+{
+ /* DATA frames add 9 bytes header plus 1 byte for padlen and additional
+ * padlen bytes. Keep below TLS maximum record size.
+ * TODO: respect pad bytes when we have that feature.
+ */
+ return (16*1024 - 10);
+}
+
#define NGH2_SET_CALLBACK(callbacks, name, fn)\
nghttp2_session_callbacks_set_##name##_callback(callbacks, fn)
@@ -618,6 +632,7 @@ static apr_status_t init_callbacks(conn_
NGH2_SET_CALLBACK(*pcb, on_begin_headers, on_begin_headers_cb);
NGH2_SET_CALLBACK(*pcb, on_header, on_header_cb);
NGH2_SET_CALLBACK(*pcb, send_data, on_send_data_cb);
+ NGH2_SET_CALLBACK(*pcb, data_source_read_length, on_data_source_read_length_cb);
return APR_SUCCESS;
}