Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 99BE71838F for ; Thu, 29 Oct 2015 14:38:54 +0000 (UTC) Received: (qmail 47088 invoked by uid 500); 29 Oct 2015 14:38:54 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 47019 invoked by uid 500); 29 Oct 2015 14:38:54 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 47010 invoked by uid 99); 29 Oct 2015 14:38:54 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2015 14:38:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id E692AC040B for ; Thu, 29 Oct 2015 14:38:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.79 X-Spam-Level: * X-Spam-Status: No, score=1.79 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id UcItLhrNMwy7 for ; Thu, 29 Oct 2015 14:38:53 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTP id 06FE920633 for ; Thu, 29 Oct 2015 14:38:53 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A5873E042E for ; Thu, 29 Oct 2015 14:38:52 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id A403D3A0289 for ; Thu, 29 Oct 2015 14:38:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1711283 - in /httpd/httpd/trunk/modules/http2: h2_conn_io.c h2_session.c Date: Thu, 29 Oct 2015 14:38:52 -0000 To: cvs@httpd.apache.org From: icing@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151029143852.A403D3A0289@svn01-us-west.apache.org> 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; }