envoy icon indicating copy to clipboard operation
envoy copied to clipboard

"Compiled" static header maps instead of big trie

Open ravenblackx opened this issue 1 year ago • 10 comments

Commit Message: "Compiled" static header maps instead of big trie Additional Description: This is slightly slower for "misses" but significantly faster for "hits". Given that the majority of headers are expected to be matches for the static table, this should be a big win. (Each faster hit pays for 30 slower misses!) This structure also uses significantly less memory than the big trie.

Performance benchmarks - bazel run -c opt test/common/http:header_map_impl_speed_test -- --benchmark_filter="bm*" --benchmark_repetitions=25 --benchmark_display_aggregates_only

Benchmark before after beforeStdDev afterStdDev change
bmHeaderMapImplRequestStaticLookupHits 47.2ns 16.4ns 0.629 0.378 -65.3%
bmHeaderMapImplResponseStaticLookupHits 34.7ns 14.3ns 0.571 0.085 -58.8%
bmHeaderMapImplRequestStaticLookupMisses 6.89ns 6.83ns 0.044 0.034 -0.01%
bmHeaderMapImplResponseStaticLookupMisses 6.40ns 7.31ns 0.028 0.057 +14.2%

Risk Level: Could be high since headers are parsed millions of times per second. But also there's a lot of existing test cases. Testing: Added tests, existing tests involving headers will also provide coverage. Docs Changes: n/a Release Notes: Not yet Platform Specific Features: n/a

ravenblackx avatar May 02 '24 15:05 ravenblackx

As a reminder, PRs marked as draft will not be automatically assigned reviewers, or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

:cat:

Caused by: https://github.com/envoyproxy/envoy/pull/33932 was opened by ravenblackx.

see: more, trace.

/retest

ravenblackx avatar May 09 '24 15:05 ravenblackx

/wait (for CI green)

jmarantz avatar May 10 '24 16:05 jmarantz

/retest

ravenblackx avatar May 10 '24 16:05 ravenblackx

/wait

jmarantz avatar May 10 '24 18:05 jmarantz

/retest

ravenblackx avatar May 13 '24 16:05 ravenblackx

wdyt of adding a diagram showing the algorithm in action, as an md file or image or whatever?

jmarantz avatar May 16 '24 19:05 jmarantz

wdyt of adding a diagram showing the algorithm in action, as an md file or image or whatever?

Done.

ravenblackx avatar May 17 '24 18:05 ravenblackx

/retest

ravenblackx avatar May 17 '24 18:05 ravenblackx

+alyssawilk for senior maintainer pass.

ravenblackx avatar May 21 '24 18:05 ravenblackx

actually I'd love to take one more quick pass; just been slammed. Give me till EOD today?

I agree this is fantastic.

jmarantz avatar May 22 '24 15:05 jmarantz