Skip to content

netty: Support never-indexed metadata keys - #12976

Open
petedmarsh wants to merge 1 commit into
grpc:masterfrom
petedmarsh:netty-never-index-metadata
Open

netty: Support never-indexed metadata keys#12976
petedmarsh wants to merge 1 commit into
grpc:masterfrom
petedmarsh:netty-never-index-metadata

Conversation

@petedmarsh

Copy link
Copy Markdown

Add NettyChannelBuilder.neverIndexMetadataKey() and neverIndexMetadataKeys() so callers can mark selected outbound metadata keys for HPACK's never-indexed literal representation.

High-cardinality metadata values provide little compression benefit and can churn the server's dynamic HPACK table. Keeping them out of the table avoids unnecessary insertion and eviction work while preserving dynamic indexing for other headers.

Propagate an immutable set of normalized metadata names through the client transport and use it in Netty's HPACK sensitivity detector. Add unit and interoperability coverage.

Generated with AI using OpenAI Codex (GPT-5).

Add NettyChannelBuilder.neverIndexMetadataKey() and neverIndexMetadataKeys() so callers can mark selected outbound metadata keys for HPACK's never-indexed literal representation.

High-cardinality metadata values provide little compression benefit and can churn the server's dynamic HPACK table. Keeping them out of the table avoids unnecessary insertion and eviction work while preserving dynamic indexing for other headers.

Propagate an immutable set of normalized metadata names through the client transport and use it in Netty's HPACK sensitivity detector. Add unit and interoperability coverage.

Generated with AI using OpenAI Codex (GPT-5).
@petedmarsh

Copy link
Copy Markdown
Author

I vibe coded a benchmark to demonstrate the effect here:

https://github.com/petedmarsh/grpc-java/pull/new/netty-never-index-metadata-benchmark

## Direct HPACK Functions

| Value profile | Metric | Indexed | Never indexed | Change |
|---|---:|---:|---:|---:|
| Low length | CPU | 0.594 us/req | 0.489 us/req | -17.68% |
| Low length | Throughput | 1,723,476 req/s | 2,094,916 req/s | +21.55% |
| Low length | Bytes | 336.458 B/req | 352.000 B/req | +4.62% |
| High length | CPU | 2.519 us/req | 1.756 us/req | -30.29% |
| High length | Throughput | 405,075 req/s | 572,970 req/s | +41.45% |
| High length | Bytes | 1,397.064 B/req | 1,333.481 B/req | -4.55% |

## End-to-end gRPC

| Value profile | Metric | Indexed | Never indexed | Change |
|---|---:|---:|---:|---:|
| Low length | CPU | 35.403 us/req | 33.563 us/req | -5.20% |
| Low length | Throughput | 25,337 req/s | 26,639 req/s | +5.14% |
| Low length | Bytes | 350.793 B/req | 362.001 B/req | +3.20% |
| High length | CPU | 33.777 us/req | 34.643 us/req | +2.56% |
| High length | Throughput | 26,493 req/s | 25,558 req/s | -3.53% |
| High length | Bytes | 1,524.585 B/req | 1,448.001 B/req | -5.02% |

Potentially either a lof of CPU or bytes transferred save depending on your mix of headers.

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.

1 participant