Skip to content

Allow disabling header compression #780

Open
@xuorig

Description

@xuorig

Header compression, while very effective in some contexts, does have a CPU overhead on encode and decode. There are other contexts where this overhead is not worth it, for example in scenarios where bandwidth and data-transfer times are non-issues.

Other h2 implementations, like Envoy's for example, allow effectively disabling header compression by setting the HPACK table size to 0.

Right now, it's possible to set a table size on h2's client, and to set it to 0, but it does not necessarily lead to performance gains. This is because entries are simply evicted when max_size is reached. In fact, a table with max_size of 0 would most likely hit the "large header special case" and returned NotIndexed. This means that encode_str is still called (with huffman) through encode_not_indexed.

I'd like to hear your thoughts on how/if it should be possible to disable (similar to envoy) either through a table_size of 0, or even an explicit configuration option. Then, if possible, we should find a way to avoid huffman encoding in those cases and write header bytes without compression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions