| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
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. |
Sorry, something went wrong.
| */ | ||
| @CanIgnoreReturnValue | ||
| public NettyChannelBuilder neverIndexMetadataKey(Metadata.Key<?> key) { | ||
| neverIndexedMetadataKeys.add(AsciiString.of(checkNotNull(key, "key").name())); |
There was a problem hiding this comment.
Should we add these methods to NettyServerBuilder as well to configure NettyServerHandler so that servers can also prevent HPACK dynamic table bloat on client peers.
Sorry, something went wrong.
| * default, no metadata keys are configured as never indexed. | ||
| */ | ||
| @CanIgnoreReturnValue | ||
| public NettyChannelBuilder neverIndexMetadataKey(Metadata.Key<?> key) { |
There was a problem hiding this comment.
Add @since 1.84.0 annotation to both methods. Also add @ExperimentalApi annotation.
Sorry, something went wrong.
| @CanIgnoreReturnValue | ||
| public NettyChannelBuilder neverIndexMetadataKeys( | ||
| Collection<? extends Metadata.Key<?>> keys) { | ||
| for (Metadata.Key<?> key : checkNotNull(keys, "keys")) { |
There was a problem hiding this comment.
If the input collection contains a null element after several valid keys, a NPE is thrown after the preceding keys have already been added to the builder's internal neverIndexedMetadataKeys set. It is cleaner to validate all elements up-front before mutation to prevent leaving the builder in a partially modified state.
Sorry, something went wrong.
|
Thanks @kannanjgithub - comments addresed |
Sorry, something went wrong.
Add NettyChannelBuilder and NettyServerBuilder APIs 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 peer's dynamic HPACK table. Keeping them out avoids unnecessary insertion and eviction work while preserving dynamic indexing for other headers. Propagate immutable normalized metadata names through client and server transports and use them in Netty's HPACK sensitivity detector. Add unit and interoperability coverage. Generated with AI using OpenAI Codex (GPT-5). Co-Authored-By: Codex <noreply@openai.com>
| Back | FazBrowse Home | New Git URL |
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).