You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Christophe JAILLET <ch...@wanadoo.fr> on 2015/11/01 08:22:20 UTC

Re: svn commit: r1711503 - in /httpd/httpd/trunk/modules/http2: h2_conn_io.c h2_conn_io.h h2_io.c h2_io.h h2_mplx.c h2_mplx.h h2_session.c h2_stream.c h2_stream.h h2_task_input.c h2_util.c h2_util.h

Hi,

Le 30/10/2015 17:15, icing@apache.org a écrit :
> Author: icing
> Date: Fri Oct 30 16:15:40 2015
> New Revision: 1711503
>
> URL: http://svn.apache.org/viewvc?rev=1711503&view=rev
> Log:
> improved h2c write performance
>
> [...]
> +static char immortal_zeros[256];
> +
>   static int on_send_data_cb(nghttp2_session *ngh2,
>                              nghttp2_frame *frame,
>                              const uint8_t *framehd,
> @@ -563,30 +557,59 @@ static int on_send_data_cb(nghttp2_sessi
>                     "h2_stream(%ld-%d): send_data_cb for %ld bytes",
>                     session->id, (int)stream_id, (long)length);
>                     
> -    status = send_data(session, (const char *)framehd, 9);
> -    if (status == APR_SUCCESS) {
> +    if (h2_conn_io_is_buffered(&session->io)) {
> +        status = h2_conn_io_write(&session->io, (const char *)framehd, 9);
> +        if (status == APR_SUCCESS) {
> +            if (padlen) {
> +                status = h2_conn_io_write(&session->io, (const char *)&padlen, 1);
> +            }
> +
> +            if (status == APR_SUCCESS) {
> +                apr_size_t len = length;
> +                status = h2_stream_readx(stream, pass_data, session,
> +                                         &len, &eos);
> +                if (status == APR_SUCCESS && len != length) {
> +                    status = APR_EINVAL;
> +                }
> +            }
> +
> +            if (status == APR_SUCCESS && padlen) {
> +                if (padlen) {
> +                    char pad[256];
> +                    memset(pad, 0, padlen);

You could save this 'pad' buffer and the 'memset' by also using the data 
from the 'static char immortal_zeros[256];' introduced above.

Maybe, using NGHTTP2_MAX_PADLEN instead of the 256 hard coded value 
would be cleaner?

CJ

Re: svn commit: r1711503 - in /httpd/httpd/trunk/modules/http2: h2_conn_io.c h2_conn_io.h h2_io.c h2_io.h h2_mplx.c h2_mplx.h h2_session.c h2_stream.c h2_stream.h h2_task_input.c h2_util.c h2_util.h

Posted by Stefan Eissing <st...@greenbytes.de>.
> Am 01.11.2015 um 08:22 schrieb Christophe JAILLET <ch...@wanadoo.fr>:
> 
> Hi,
> 
> Le 30/10/2015 17:15, icing@apache.org a écrit :
>> [...]+            if (status == APR_SUCCESS && padlen) {
>> +                if (padlen) {
>> +                    char pad[256];
>> +                    memset(pad, 0, padlen);
> 
> You could save this 'pad' buffer and the 'memset' by also using the data from the 'static char immortal_zeros[256];' introduced above.

Good idea, will do.

> Maybe, using NGHTTP2_MAX_PADLEN instead of the 256 hard coded value would be cleaner?

That is in an internal header file from nghttp2. Will add an own #define in mod_http2 headers to make it clear where the limit comes from.

//Stefan