Header Compression

In HTTP2

HTTP2 Provided

  • Stream Multiplexing
  • Binary Framing Layer
  • Flow Control
  • Server Push
  • Priorities and dependencies
  • Header Compression

RFC 7541:

RFC 7540:

HTTP2 is all about performance on the client side

We want:

  • reduce RTT
  • reduce latency
  • reduce packet size

In HTTP/1.1

We are using:

  • HTML compression by remove whitespace :)
  • gzip
  • combo

In HTTP/2

We can use:

  • Header compression

Why we need Header Compression

25% network traffic is the protocol overhead

What is HPACK

(Copy from ilya grigorik's ppt)

Static Dictionary

Dynamic Table

  • manage the header fields which is unlisted  in static table
  • sharing the table on the same connection (connection sensitive)
  • consists of a list of header fields maintained in FIFO order

Static Huffman Encoding

  • this code was generated from statistics obtained
  • no known attack against a static Huffman encoding

HPACK Detail

Indexed Header Field Representation

已被索引的头部

Literal Header Field with Incremental Indexing -- Indexed Name

name在索引 value不在索引

Literal Header Field with Incremental Indexing -- New Name

name, value都没被索引

Literal Header Field without Indexing -- Indexed Name

name被索引, value未索引且不添加至动态字典

Literal Header Field without Indexing -- Indexed Name

name, value都未被索引且不添加至动态字典

Literal Header Field Never Indexed -- Indexed Name

name在索引表中, value不在,且绝对不允许被索引

Literal Header Field Never Indexed -- New Name

name 和 value 都不在索引表中,且绝对不允许被索引

How to test

brew update
brew install nghttp2

h2load https://anyh2website.com -n 2 | tail -6 |head -1  

Reference

Thanks

Q ?

Made with Slides.com