-
Notifications
You must be signed in to change notification settings - Fork 143
Description
I patched my Nginx 1.13.1 server with your 1.13.1 version of HTTP/2 full HPACK encoding patch but using h2load tests outlined at https://blog.cloudflare.com/hpack-the-silent-killer-feature-of-http-2/, I am not seeing the header savings expected on subsequent h2load test runs ?
The test page is just a single index.html page so not sure if that matters ?
url=https://domain.com
the headers
curl -I $url
HTTP/2 200
date: Fri, 23 Jun 2017 11:36:50 GMT
content-type: text/html; charset=utf-8
content-length: 6090
last-modified: Fri, 23 Jun 2017 11:24:24 GMT
vary: Accept-Encoding
etag: "594cfa68-17ca"
server: nginx centminmod
x-powered-by: centminmod
expires: Sat, 24 Jun 2017 11:36:50 GMT
cache-control: max-age=86400
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
accept-ranges: bytes
h2load test runs 1-4
h2load --version
h2load nghttp2/1.24.0-DEV
with cloudflare HTTP/2 HPACK Full encoding patch
for i in $(seq 1 4); do echo "h2load run $i"; h2load $url -n $i | tail -6 | head -1; done
h2load run 1
traffic: 6.33KB (6481) total, 324B (324) headers (space savings 15.62%), 5.95KB (6090) data
h2load run 2
traffic: 12.61KB (12913) total, 648B (648) headers (space savings 15.62%), 11.89KB (12180) data
h2load run 3
traffic: 18.89KB (19345) total, 972B (972) headers (space savings 15.62%), 17.84KB (18270) data
h2load run 4
traffic: 25.17KB (25777) total, 1.27KB (1296) headers (space savings 15.62%), 23.79KB (24360) dat
without cloudflare HTTP/2 HPACK Full encoding patch strange get higher compression levels/header space savings ?
for i in $(seq 1 4); do echo "h2load run $i"; h2load $url -n $i | tail -6 | head -1; done
h2load run 1
traffic: 6.29KB (6442) total, 285B (285) headers (space savings 25.78%), 5.95KB (6090) data
h2load run 2
traffic: 12.53KB (12835) total, 570B (570) headers (space savings 25.78%), 11.89KB (12180) data
h2load run 3
traffic: 18.78KB (19228) total, 855B (855) headers (space savings 25.78%), 17.84KB (18270) data
h2load run 4
traffic: 25.02KB (25621) total, 1.11KB (1140) headers (space savings 25.78%), 23.79KB (24360) data
4 run h2load full results with HPACK full encoding patch
h2load $url -n 4
starting benchmark...
spawning thread #0: 1 total client(s). 4 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 25% done
progress: 50% done
progress: 75% done
progress: 100% done
finished in 2.22ms, 1798.56 req/s, 11.05MB/s
requests: 4 total, 4 started, 4 done, 4 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 4 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 25.17KB (25777) total, 1.27KB (1296) headers (space savings 15.62%), 23.79KB (24360) data
min max mean sd +/- sd
time for request: 59us 142us 88us 32us 75.00%
time for connect: 1.46ms 1.46ms 1.46ms 0us 100.00%
time to 1st byte: 1.61ms 1.61ms 1.61ms 0us 100.00%
req/s : 2121.60 2121.60 2121.60 0.00 100.00%
4 run h2load full result without HPACK full encoding patch
h2load $url -n 4
starting benchmark...
spawning thread #0: 1 total client(s). 4 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 25% done
progress: 50% done
progress: 75% done
progress: 100% done
finished in 2.19ms, 1825.65 req/s, 11.15MB/s
requests: 4 total, 4 started, 4 done, 4 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 4 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 25.02KB (25621) total, 1.11KB (1140) headers (space savings 25.78%), 23.79KB (24360) data
min max mean sd +/- sd
time for request: 70us 147us 99us 29us 75.00%
time for connect: 1.41ms 1.41ms 1.41ms 0us 100.00%
time to 1st byte: 1.55ms 1.55ms 1.55ms 0us 100.00%
req/s : 2124.74 2124.74 2124.74 0.00 100.00%
nghttp2 -nv run with HTTP/2 HPACK full encoding patch
nghttp -nv $url
[ 0.053] Connected
The negotiated protocol: h2
[ 0.055] recv SETTINGS frame <length=18, flags=0x00, stream_id=0>
(niv=3)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):128]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65536]
[SETTINGS_MAX_FRAME_SIZE(0x05):16777215]
[ 0.055] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=2147418112)
[ 0.055] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 0.055] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.055] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
(dep_stream_id=0, weight=201, exclusive=0)
[ 0.055] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
(dep_stream_id=0, weight=101, exclusive=0)
[ 0.055] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
(dep_stream_id=0, weight=1, exclusive=0)
[ 0.055] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
(dep_stream_id=7, weight=1, exclusive=0)
[ 0.055] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
(dep_stream_id=3, weight=1, exclusive=0)
[ 0.055] send HEADERS frame <length=48, flags=0x25, stream_id=13>
; END_STREAM | END_HEADERS | PRIORITY
(padlen=0, dep_stream_id=11, weight=16, exclusive=0)
; Open new stream
:method: GET
:path: /
:scheme: https
:authority: domain.com
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/1.24.0-DEV
[ 0.055] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.055] recv (stream_id=13) :status: 200
[ 0.055] recv (stream_id=13) date: Fri, 23 Jun 2017 11:47:37 GMT
[ 0.055] recv (stream_id=13) content-type: text/html; charset=utf-8
[ 0.055] recv (stream_id=13) last-modified: Fri, 23 Jun 2017 11:24:24 GMT
[ 0.055] recv (stream_id=13) vary: Accept-Encoding
[ 0.055] recv (stream_id=13) etag: W/"594cfa68-17ca"
[ 0.055] recv (stream_id=13) server: nginx centminmod
[ 0.055] recv (stream_id=13) x-powered-by: centminmod
[ 0.055] recv (stream_id=13) expires: Sat, 24 Jun 2017 11:47:37 GMT
[ 0.055] recv (stream_id=13) cache-control: max-age=86400
[ 0.055] recv (stream_id=13) x-frame-options: SAMEORIGIN
[ 0.055] recv (stream_id=13) x-xss-protection: 1; mode=block
[ 0.055] recv (stream_id=13) x-content-type-options: nosniff
[ 0.055] recv (stream_id=13) content-encoding: gzip
[ 0.055] recv HEADERS frame <length=311, flags=0x04, stream_id=13>
; END_HEADERS
(padlen=0)
; First response header
[ 0.055] recv DATA frame <length=1951, flags=0x01, stream_id=13>
; END_STREAM
[ 0.055] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
now without HTTP/2 HPACK full encoding patch
nghttp -nv $url
[ 0.043] Connected
The negotiated protocol: h2
[ 0.044] recv SETTINGS frame <length=18, flags=0x00, stream_id=0>
(niv=3)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):128]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65536]
[SETTINGS_MAX_FRAME_SIZE(0x05):16777215]
[ 0.044] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=2147418112)
[ 0.044] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 0.044] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.044] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
(dep_stream_id=0, weight=201, exclusive=0)
[ 0.044] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
(dep_stream_id=0, weight=101, exclusive=0)
[ 0.044] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
(dep_stream_id=0, weight=1, exclusive=0)
[ 0.044] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
(dep_stream_id=7, weight=1, exclusive=0)
[ 0.044] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
(dep_stream_id=3, weight=1, exclusive=0)
[ 0.044] send HEADERS frame <length=48, flags=0x25, stream_id=13>
; END_STREAM | END_HEADERS | PRIORITY
(padlen=0, dep_stream_id=11, weight=16, exclusive=0)
; Open new stream
:method: GET
:path: /
:scheme: https
:authority: domain.com
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/1.24.0-DEV
[ 0.045] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.045] recv (stream_id=13) :status: 200
[ 0.045] recv (stream_id=13) date: Fri, 23 Jun 2017 11:58:49 GMT
[ 0.045] recv (stream_id=13) content-type: text/html; charset=utf-8
[ 0.045] recv (stream_id=13) last-modified: Fri, 23 Jun 2017 11:24:24 GMT
[ 0.045] recv (stream_id=13) vary: Accept-Encoding
[ 0.045] recv (stream_id=13) etag: W/"594cfa68-17ca"
[ 0.045] recv (stream_id=13) server: nginx centminmod
[ 0.045] recv (stream_id=13) x-powered-by: centminmod
[ 0.045] recv (stream_id=13) expires: Sat, 24 Jun 2017 11:58:49 GMT
[ 0.045] recv (stream_id=13) cache-control: max-age=86400
[ 0.045] recv (stream_id=13) x-frame-options: SAMEORIGIN
[ 0.045] recv (stream_id=13) x-xss-protection: 1; mode=block
[ 0.045] recv (stream_id=13) x-content-type-options: nosniff
[ 0.045] recv (stream_id=13) content-encoding: gzip
[ 0.045] recv HEADERS frame <length=282, flags=0x04, stream_id=13>
; END_HEADERS
(padlen=0)
; First response header
[ 0.045] recv DATA frame <length=1951, flags=0x01, stream_id=13>
; END_STREAM
[ 0.045] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
nginx -V
nginx version: nginx/1.13.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
built with OpenSSL 1.0.2l 25 May 2017
TLS SNI support enabled
configure arguments: --with-ld-opt='-ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib' --with-cc-opt='-m64 -march=native -DTCP_FASTOPEN=23 -g -O3 -fstack-protector-strong -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf' --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-compat --with-http_stub_status_module --with-http_secure_link_module --with-libatomic --with-http_gzip_static_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-stream_geoip_module --with-stream_realip_module --with-stream_ssl_preread_module --with-threads --with-stream=dynamic --with-stream_ssl_module --with-http_realip_module --add-dynamic-module=../ngx-fancyindex-0.4.0 --add-module=../ngx_cache_purge-2.3 --add-module=../ngx_devel_kit-0.3.0 --add-module=../set-misc-nginx-module-0.31 --add-module=../echo-nginx-module-0.60 --add-module=../redis2-nginx-module-0.14 --add-module=../ngx_http_redis-0.3.7 --add-module=../memc-nginx-module-0.18 --add-module=../srcache-nginx-module-0.31 --add-module=../headers-more-nginx-module-0.32 --with-pcre=../pcre-8.40 --with-pcre-jit --with-zlib=../zlib-1.2.11 --with-http_ssl_module --with-http_v2_module --with-openssl=../openssl-1.0.2l
grep -C3 -rnw NGX_HTTP_V2_HPACK_ENC /svr-setup/nginx-1.13.1 | grep -v '.patch'
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_filter_module.c-416- pos = ngx_http_v2_write_int(pos, ngx_http_v2_prefix(5),
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_filter_module.c-417- h2c->max_hpack_table_size);
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_filter_module.c-418- h2c->indicate_resize = 0;
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_filter_module.c:419:#if (NGX_HTTP_V2_HPACK_ENC)
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_filter_module.c-420- ngx_http_v2_table_resize(h2c);
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_filter_module.c-421-#endif
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_filter_module.c-422- }
--
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_table.c-349-}
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_table.c-350-
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_table.c-351-
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_table.c:352:#if (NGX_HTTP_V2_HPACK_ENC)
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_table.c-353-
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_table.c-354-static ngx_int_t
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2_table.c-355-hpack_get_static_index(ngx_http_v2_connection_t *h2c, u_char *val, size_t len);
--
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-117-} ngx_http_v2_hpack_t;
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-118-
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-119-
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h:120:#if (NGX_HTTP_V2_HPACK_ENC)
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-121-typedef struct {
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-122- uint64_t hash_val;
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-123- uint32_t index;
--
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-197- unsigned goaway:1;
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-198- unsigned indicate_resize:1;
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-199-
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h:200:#if (NGX_HTTP_V2_HPACK_ENC)
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-201- ngx_http_v2_hpack_enc_t hpack_enc;
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-202-#endif
/svr-setup/nginx-1.13.1/src/http/v2/ngx_http_v2.h-203-};
--
--
--
--
--
--
/svr-setup/nginx-1.13.1/auto/modules-437- fi
/svr-setup/nginx-1.13.1/auto/modules-438-
/svr-setup/nginx-1.13.1/auto/modules-439- if [ $HTTP_V2_HPACK_ENC = YES ]; then
/svr-setup/nginx-1.13.1/auto/modules:440: have=NGX_HTTP_V2_HPACK_ENC . auto/have
/svr-setup/nginx-1.13.1/auto/modules-441- fi
/svr-setup/nginx-1.13.1/auto/modules-442-
/svr-setup/nginx-1.13.1/auto/modules-443- if :; then