Skip to content

Add option to disable HPACK dynamic table - #12973

Open
petedmarsh wants to merge 2 commits into
grpc:masterfrom
petedmarsh:disable-dynamic-hpack
Open

Add option to disable HPACK dynamic table#12973
petedmarsh wants to merge 2 commits into
grpc:masterfrom
petedmarsh:disable-dynamic-hpack

Conversation

@petedmarsh

Copy link
Copy Markdown

Add disableHpackDynamicTable() to the Netty client and server builders.

When enabled, Netty uses a zero-sized HPACK dynamic table and advertises SETTINGS_HEADER_TABLE_SIZE = 0 to its peer. The default remains unchanged.

Also fix grpc-okhttp to apply a peer's header-table setting to its outbound encoder instead of its inbound decoder.

Compliant peers require no configuration changes. Older grpc-okhttp releases must be upgraded before enabling this option on their Netty peer.

OpenAI Codex (GPT-5) was used to implement all changes in this PR.

Add client and server builder controls that disable HPACK dynamic table use
in both directions. Advertise a zero header table size and keep the encoder
table pinned at zero when the peer changes its setting.

Add encoder, handler, builder, transport, and interoperability coverage.

AI assistance: OpenAI Codex (GPT-5) was used to review these HPACK changes
and strengthen the tests.
Apply SETTINGS_HEADER_TABLE_SIZE to the outbound HPACK writer before
acknowledging it, so the next header block emits the required dynamic table
size update. Stop applying the peer encoder setting to the inbound decoder.

Add framed unit coverage and bidirectional OkHttp-Netty regression tests.
The tests verify that repeated calls remain on one transport.

AI assistance: OpenAI Codex (GPT-5) was used to implement and test this
grpc-okhttp compatibility fix.
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 6, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@petedmarsh petedmarsh changed the title Disable dynamic hpack Add option to disable HPACK dynamic table Aug 6, 2026
@ejona86

ejona86 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Can you describe what your goal is? It seems like it is to reduce idle memory usage?

The okhttp bug has been on our radar, but needed some further investigation (#12819 . #12818 is similar but I saw it didn't remove hpackReader.headerTableSizeSetting(), so it was highly suspect; it was also AI-generated, and we really want a human to look at it). We will definitely want to keep any changes there as a separate commit.

@petedmarsh

petedmarsh commented Aug 6, 2026 via email

Copy link
Copy Markdown
Author

@ejona86

ejona86 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Can you share what function(s) is hot? Is it the key/value hashing?

Receiving indexed values in HPACK seems reasonably cheap. I expect it is just the encoder costing you.

One thing for us to consider is this approach looks to be incompatible with Http2FrameCodecBuilder. We really need to migrate off the old Netty API that we are using, at which point we'll be limited to what Http2FrameCodecBuilder offers. (So then we have to either drop this feature or upstream it to Netty.)

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