3 ms·
I want to benchmark this, because intuitively I disagree. The HPACK spec is a pretty easy read [1]. There is a static, hardcoded table that contains most of th
by niftich 10y ago
I want to benchmark this, because intuitively I disagree.
The HPACK spec is a pretty easy read [1]. There is a static, hardcoded table that contains most of the HTTP header names, and even some common predefined KV pairs. You save some bytes on the wire if your header's name or value is one of these entries; the header name will essentially always will be in the static table.
But for names and values that aren't in the static table, you have to put them into the dynamic table and encode them using either the integer packing or the huffman code. The client has to decompress these, of course.
On future requests, you have some leftover state in your dynamic table so future 'duplicate' headers are packed, and take up very little space. But for the first (ever) HTTP request-response pair, you have to trade ALL the headers in "full". So the true benefits of the dynamic table don't kick in.
[1] https://http2.github.io/http2-spec/compression.html#header.encoding https://http2.github.io/http2-spec/compression.html#header.e...