nghttp2
The heir of spdylay
nghttp2 is HTTP/2.0 C library
Why did you name it as “nghttp2”?
Why did you name it as “nghttp2”?
First Iteration
HTTP-draft-04/2.0
First Iteration: HTTP-draft-04/2.0
How did you migrate from spdylay?
417 Expectation Failed
HEADER COMPRESSION (HPACK)
HPACK encoding algo in nghttp2
Tools in nghttp2
nghttp: HTTP/2.0 client
nghttpd: HTTP/2.0 server
nghttpx: HTTP/2.0 proxy
nghttpx: HTTP/2.0 proxy
First Interop Test
HTTP-draft-04/2.0
First Interop Test (draft-04)
First Interop Results (1)
First Interop Results (2)
First Interop Results (3)
First Interop Summary
Second Iteration
HTTP-draft-06/2.0
Second Iteration: HTTP-draft-06/2.0
HPACK 03 Best Pitfall
HPACK 03 Best Pitfall
1. Encode (k1, v1)
in the reference set, which means it is common (aka implied) header. Nothing emitted.
HPACK 03 Best Pitfall
2. Encode (k4, v4)
Use Literal rep with incremental indexing
Adding (k4, v4) will remove (k1, v1) because of size limitation.
HPACK 03 Best Pitfall
Encoding is over.
HPACK 03 Best Pitfall
Decoding
Process (k4,v4)
HPACK 03 Best Pitfall
Decoding
Emit (k4, v4),
Remove (k1, v1) and add (k4, v4) to header table,
HPACK 03 Best Pitfall
Decoding
Emit common header, which is in the reference set but not emitted: NONE
HPACK 03 Best Pitfall
Decoding is over
Decoder misses
(k1, v1)!
HPACK 03 Best Pitfall
How to fix?
When encoding (k4, v4), if adding (k4, v4) will remove (k1, v1), and (k1, v1) is common header and not emitted, emit indexed representation twice.
HPACK 03 Best Pitfall
How to fix?
When encoding (k4, v4), if adding (k4, v4) will remove (k1, v1), and (k1, v1) is common header and not emitted, emit indexed representation twice.
HPACK 03 Best Pitfall
How to fix?
When encoding (k4, v4), if adding (k4, v4) will remove (k1, v1), and (k1, v1) is common header and not emitted, emit indexed representation twice.
Prepare for the consequences of removing implied header from the table
When you are implementing HPACK, relay these words:
Upcoming HPACK changes
Upcoming HPACK Changes
Upcoming HPACK Changes
We can achieve 0.36 compression ratio
(0.37 with HPACK-03) → 1 point improvement
Test case: mnot data set https://github.com/http2/http_samples
Upcoming HPACK Changes
Experiment with various size of table buffer size
Buffer (KiB) Ratio�2 0.42�4 0.36 ← Default�8 0.32�16 0.30�32 0.29�64 0.28�128 0.28�256 0.28 ← Saturation point because no eviction occurs�512 0.28�
Upcoming HPACK Changes
I have actually experimented it
Used huffman codes described in: http://tools.ietf.org/html/draft-rpeon-httpbis-header-compression-03
We can achieve 0.28 compression ratio
(0.37 with HPACK-03) → 9 point improvement
�Code is here
https://github.com/tatsuhiro-t/nghttp2/tree/hpack-exp
Any Questions?
Exploits of a Mom