grpclb: Cache Subchannels for 10 seconds after it is removed from the backendlist#4238
Merged
zhangkun83 merged 3 commits intogrpc:masterfrom Mar 23, 2018
Merged
Conversation
… backendlist. This is to conform with the GRPCLB spec. The spec doesn't (yet) define the actual timeout. We choose 10 seconds here arbitrarily. It may be configurable in the future. This will fix internal bug b/74410243
dapengzhang0
approved these changes
Mar 22, 2018
| Subchannel takeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes); | ||
|
|
||
| /** | ||
| * Returns a {@link Subchannel} to the pool. |
Contributor
There was a problem hiding this comment.
Maybe define 'return' more clearly?
Contributor
Author
There was a problem hiding this comment.
Rephrased it to "Puts ... back".
|
|
||
| @Override | ||
| public void returnSubchannel(Subchannel subchannel) { | ||
| CacheEntry prev = cache.get(subchannel.getAddresses()); |
Contributor
There was a problem hiding this comment.
Return immediately if prev != null && prev.subchannel == subchannel
| } | ||
|
|
||
| @VisibleForTesting | ||
| class ShutdownSubchannelTask implements Runnable { |
zhangkun83
commented
Mar 22, 2018
| Subchannel takeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes); | ||
|
|
||
| /** | ||
| * Returns a {@link Subchannel} to the pool. |
Contributor
Author
There was a problem hiding this comment.
Rephrased it to "Puts ... back".
|
|
||
| @Override | ||
| public void returnSubchannel(Subchannel subchannel) { | ||
| CacheEntry prev = cache.get(subchannel.getAddresses()); |
| } | ||
|
|
||
| @VisibleForTesting | ||
| class ShutdownSubchannelTask implements Runnable { |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This is to conform with the GRPCLB spec. The spec doesn't (yet) define
the actual timeout. We choose 10 seconds here arbitrarily. It may be
configurable in the future.
This will fix internal bug b/74410243
@slash-lib