feat(transport): Connect lazily in the load balanced channel#493
Merged
LucioFranco merged 3 commits intohyperium:masterfrom Nov 18, 2020
Merged
feat(transport): Connect lazily in the load balanced channel#493LucioFranco merged 3 commits intohyperium:masterfrom
LucioFranco merged 3 commits intohyperium:masterfrom
Conversation
This was referenced Mar 18, 2021
Closed
This file contains hidden or 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
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.
Motivation
If the first connection to the endpoint in an
Insertchangeset fails, the service goes into a failed state and the channel is dropped:This is not coherent with the behavior we observe if the connection is broken after having successfully connected at least once - the channel remains open and we try to reconnect without disrupting calls.
Solution
The current PR makes the connection step lazy by default in the load balanced channel.
An alternative approach would be to allow the caller to choose if it should connect eagerly (and crash if the first connection fails) or be lazy - maybe as an additional parameter on
balance_channel? Or abalance_channel_lazy? Or alazyproperty on theEndpoint?Why are we touching this?
We have been trying to build a client-side load balanced gRPC client on top of
tonicload balanced channel using a background task probing the DNS on a schedule. We'd be happy to add it as an example totonicitself (including the test that got us here 😅 )