alternate_protocols_cache: Impose a max size limit on the alternate protocols cache#18258
Conversation
…rotocols cache Implement a very basic MRU map in AlternateProtocolsCacheImpl. Signed-off-by: Ryan Hamilton <rch@google.com>
|
/assign @RenjieTang |
RenjieTang
left a comment
There was a problem hiding this comment.
Looking good!
Looks like some tests need fixing?
RyanTheOptimist
left a comment
There was a problem hiding this comment.
Also fixed the failing test (by initializing max_entries_ to 1024, as specified in the proto, when the argument is 0.
Signed-off-by: Ryan Hamilton <rch@google.com> Signed-off-by: Ryan Hamilton <rch@google.com>
359fb22 to
133ef91
Compare
|
/assign @alyssawilk |
alyssawilk
left a comment
There was a problem hiding this comment.
Thanks again for being up for tackling this TODO!
| // List of origin, alternate protocol pairs, in insertion order. | ||
| std::list<OriginProtocols> protocols_list_; | ||
| // Map from hostname to iterator into protocols_list_. | ||
| std::map<Origin, std::list<OriginProtocols>::iterator> protocols_map_; |
There was a problem hiding this comment.
since we already depend on quiche for the spdy wire parsing, what do you think of also pulling in quiche's linked hash map?
There was a problem hiding this comment.
Oh, good call! I didn't even consider that. It's a much simpler change. Thanks! Done.
Signed-off-by: Ryan Hamilton <rch@google.com>
alyssawilk
left a comment
There was a problem hiding this comment.
LGTM modulo the one remaining question :-P
| struct OriginHash { | ||
| size_t operator()(const Origin& origin) const { | ||
| size_t hash = std::hash<std::string>()(origin.scheme_) + | ||
| 37 * (std::hash<std::string>()(origin.hostname_) + |
There was a problem hiding this comment.
Ah, I stole this from source/common/upstream/load_balancer_impl.h which seems to be based on a pattern that's referenced in Effective Java (a great book). Good enough?
There was a problem hiding this comment.
Also added a comment.
|
/retest |
|
Retrying Azure Pipelines: |
* main: (114 commits) kafka: add header support to mesh-filter (envoyproxy#18248) rbac: add support for upstream ip policy. (envoyproxy#17645) SIPProxy BUGFIX UT failure for fastbuild/debug (envoyproxy#18303) quic: updating goaway code (envoyproxy#18291) various tiny fixes (envoyproxy#18287) dns cache: remove assert at this layer (envoyproxy#18301) [ext_authz]: ext_authz filter unit test that use real threading (envoyproxy#17742) signal action: fully disable sigaltstack on Apple (envoyproxy#18299) Add missing dependencies (envoyproxy#18297) ext_proc: Pass stream_info to gRPC streams (envoyproxy#18190) use clang 12 (envoyproxy#18220) Update PR template to include the "Fixes commit" message when reverting or fixing bad commits (envoyproxy#18298) [test] Fixing integration test to cleanup cleanly (envoyproxy#18293) test: moving grpc bridge tests out of core directory (envoyproxy#18227) runtime: disable deprecated extensions names by default (envoyproxy#18239) quiche: updating deps (envoyproxy#18272) sip_proxy: SIP protocol support in envoy (envoyproxy#18039) http: add core retry policy to route retry policy conversion utility (envoyproxy#17803) build: updating stale visibility (envoyproxy#18278) alternate_protocols_cache: Impose a max size limit on the alternate protocols cache (envoyproxy#18258) ... Signed-off-by: Michael Puncel <mpuncel@squareup.com>
alternate_protocols_cache: Impose a max size limit on the alternate protocols cache
Implement a very basic MRU map in AlternateProtocolsCacheImpl.
Risk Level: Low
Testing: Unit tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A