Using map to store the listener in ConnectionHandlerImpl#19362
Using map to store the listener in ConnectionHandlerImpl#19362ggreenway merged 13 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
| EXPECT_CALL(*access_log_, log(_, _, _, _)); | ||
| } | ||
|
|
||
| TEST_F(ConnectionHandlerTest, OldBehaviorMatchFirstWildcardListener) { |
There was a problem hiding this comment.
A note for the reviewer, the original test ensure the first listener matched since the original code using the list. After using the unorder map, so this behavior changed. I assume the MatchFirst isn't part of API contract, so I remove it.
There was a problem hiding this comment.
according to this PR #16914, there should be no one depends on the matching order
|
Thanks. It's great and added some comments. cc @rojkov |
|
/assign |
|
@wbpcode thanks for the review! |
|
In addition, we may need distinguish the listener of different protocols. Check #17414. |
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
thanks for another good point! |
| } | ||
|
|
||
| Network::InternalListenerOptRef | ||
| ConnectionHandlerImpl::findByAddress(const Network::Address::InstanceConstSharedPtr& address) { |
There was a problem hiding this comment.
I'm thinking to change this method name as findInternalListenerByAddress, since the assertion as below, this method is only used for internal listener.
| @@ -224,58 +242,46 @@ ConnectionHandlerImpl::getBalancedHandlerByTag(uint64_t listener_tag) { | |||
|
|
|||
| Network::BalancedConnectionHandlerOptRef | |||
| ConnectionHandlerImpl::getBalancedHandlerByAddress(const Network::Address::Instance& address) { | |||
There was a problem hiding this comment.
also think about change this method name to getBalancedTCPHandlerByAddress, since this method is only used for TCP listener
|
After @wbpcode approves I'll assign to a maintainer for the next pass. Thanks! |
wbpcode
left a comment
There was a problem hiding this comment.
This looks good for me overall. And just some minor comments.
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
thanks for the review! |
|
@wbpcode appreciate if you can take a look at again! |
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
ggreenway
left a comment
There was a problem hiding this comment.
This looks really good. A few questions, and some comments to add. Thanks for fixing this scalability bottleneck!
/wait
| if (listener.second.listener_->listenerTag() == listener_tag) { | ||
| listener.second.listener_->shutdownListener(); | ||
| if (auto iter = listener_map_by_tag_.find(listener_tag); iter != listener_map_by_tag_.end()) { | ||
| if (iter->second->listener_->listener() != nullptr) { |
There was a problem hiding this comment.
How can it be in this map, and have a nullptr listener?
There was a problem hiding this comment.
We will stop the listener before draining it, the shutdownListener() https://github.com/envoyproxy/envoy/pull/19362/files#diff-fe538327af200510b78cadc759f2c3af989c822a370d3f8a005b92bc59568aa5R153 will reset the pointer. Then it is going to be nullptr. That means if we shutdown twice, then the second time you will see a nullptr.
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
|
@ggreenway thanks for the review! I addressed your comments except for #19362 (comment), but let me know if you expect the assertion used there. |
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
|
When upgrading our Istio test suites to this version everything started going a little wonky. I am not 100% sure what's happening but it looks like listeners are getting mixed up - calls are going to the wrong listeners as far as I can tell This is happening with bind_to_port=false. We were able to isolate the regression to this commit. cc @lambdai |
|
It wouldn't surprise me if with bind_to_port = false we now have some ordering variability or something else. Feel free to revert this PR until we sort that out. cc @soulxu |
|
I will do some tests on |
@howardjohn do you have more failure info, or which testcase are failing. I checked the test, we have few tests on envoy/test/server/connection_handler_test.cc Line 959 in a844baf envoy/test/server/connection_handler_test.cc Line 771 in a844baf I only thought the 0 port address can be a problem. But that shouldn't the case, since I can't create multiple 0 port addresses with bind_to_port as false. |
|
Not Envoy tests, but Istio tests. It's pretty much all of our tests (
istio/istio#37004) since it seems all requests go
to random listeners
…On Thu, Feb 3, 2022 at 8:44 AM xuhj ***@***.***> wrote:
When upgrading our Istio test suites to this version everything started
going a little wonky. I am not 100% sure what's happening but it looks like
listeners are getting mixed up - calls are going to the wrong listeners as
far as I can tell This is happening with bind_to_port=false. We were able
to isolate the regression to this commit.
cc @lambdai <https://github.com/lambdai>
@howardjohn <https://github.com/howardjohn> do you have more failure
info, or which testcase are failing. I checked the test, we have few tests
on bind_to_port = false case
https://github.com/envoyproxy/envoy/blob/a844bafc3130667f79fc1846a2e4b25831bbb5c8/test/server/connection_handler_test.cc#L959
https://github.com/envoyproxy/envoy/blob/a844bafc3130667f79fc1846a2e4b25831bbb5c8/test/server/connection_handler_test.cc#L771
I only thought the 0 port address can be a problem. But that shouldn't the
case, since I can't create multiple 0 port addresses with bind_to_port as
false.
—
Reply to this email directly, view it on GitHub
<#19362 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEYGXKPSFOXMUHPNQFVRW3UZKWF3ANCNFSM5K5NLPWQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I could be wrong here envoy/source/server/connection_handler_impl.cc Lines 245 to 249 in a844baf I should check |
…oyproxy#19362)" This reverts commit 67c2b72. Signed-off-by: He Jie Xu <hejie.xu@intel.com>
…19362) Switch from list to map to avoid config load performance issues with large numbers of listeners. Signed-off-by: He Jie Xu <hejie.xu@intel.com> Signed-off-by: Josh Perry <josh.perry@mx.com>
Commit Message: Using map to store the listener in ConnectionHandlerImpl
Additional Description:
Risk Level: low
Testing: unittest
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: no
Signed-off-by: He Jie Xu hejie.xu@intel.com