Skip to content

netty: Increase HPACK encoder bucket count to 128 - #13077

Open
petedmarsh wants to merge 1 commit into
grpc:masterfrom
petedmarsh:netty-hpack-128-buckets
Open

petedmarsh wants to merge 1 commit into
grpc:masterfrom
petedmarsh:netty-hpack-128-buckets

Conversation

@petedmarsh

@petedmarsh petedmarsh commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Increase the HPACK encoder bucket count from 16 to 128 for both clients and servers. Netty 4.1.138/4.2.18 limits encoder tables to bucket count × 64 when processing a peer's table-size setting, so this allows up to 8 KiB within the peer's advertised limit. Advertised table sizes and the Netty dependency version are unchanged.

Separate JMH benchmark and results: at the same 4 KiB capacity, 128 buckets reduced synthetic mixed-header processing time by 24–28%, with unchanged per-request allocation and encoded size. Encoder construction allocated an additional 896 bytes with compressed references.

Related to #12973. Discovered by @ejona86.

Http2FrameReader frameReader = new DefaultHttp2FrameReader(headersDecoder);
Http2HeadersEncoder encoder = new DefaultHttp2HeadersEncoder(
sensitivityDetector(neverIndexedMetadataKeys), false, 16, Integer.MAX_VALUE);
sensitivityDetector(neverIndexedMetadataKeys), false, 128, Integer.MAX_VALUE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a TODO to upstream changes to Netty before we can migrate to the Http2FrameCodecBuilder API that does not allow injecting a custom Http2HeadersEncoder subclass?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants