-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dial only application servers that serve the requested application #12217
Merged
gabrielcorado
merged 8 commits into
master
from
gabrielcorado/fix-dialing-all-app-servers
Apr 28, 2022
Merged
Dial only application servers that serve the requested application #12217
gabrielcorado
merged 8 commits into
master
from
gabrielcorado/fix-dialing-all-app-servers
Apr 28, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smallinsky
approved these changes
Apr 27, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix, LGTM.
atburke
approved these changes
Apr 27, 2022
gabrielcorado
added a commit
that referenced
this pull request
Apr 28, 2022
…12217) * feat(reversetunnel): add a dial counter on fake remote site * refactor(app): change `MatchHealthy` to close connections * refactor(app): change `MatchAll` order to not dial all servers * refactor(app): only close connection when dial succeeds
gabrielcorado
added a commit
that referenced
this pull request
Apr 28, 2022
…12217) * feat(reversetunnel): add a dial counter on fake remote site * refactor(app): change `MatchHealthy` to close connections * refactor(app): change `MatchAll` order to not dial all servers * refactor(app): only close connection when dial succeeds
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #12121.
When the service receives an application request, it checks for servers to which it can forward it. This is done by checking if the server is healthy (by dialing it) and if the application’s public address match. After that, it will cache this server list for future requests. Before this PR, the handler first tries to match healthy applications, meaning that all application servers returned by
GetApplicationServers
, including the ones that could not serve the request were getting dialed.This PR changes the order of
MatchAll
to first match the public address and then dial the servers, limiting theMatchHealthy
to servers that can serve the request.For reviewers, here is a short guide on what was changed:
lib/srv/app/session.go
: Change on theMatchAll
order (described earlier);lib/srv/app/handler_test.go
: Contains a testTestMatchApplicationServers
that guarantees no additional servers are being dialed. The other changes on this file are the necessary setup for making application requests to theHandler
(there is a lot of stuff, feel free to suggest any improvement).lib/srv/app/match.go
andlib/srv/app/match_test.go
: Additional change to close connections opened onMatchHealthy
. This was found while writing the tests.