-
Notifications
You must be signed in to change notification settings - Fork 3.9k
grpclb: Cache Subchannels for 10 seconds after it is removed from the backendlist #4238
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
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
| Subchannel takeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes); | ||
|
|
||
| /** | ||
| * Returns a {@link Subchannel} to the pool. |
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.
Maybe define 'return' more clearly?
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.
Rephrased it to "Puts ... back".
|
|
||
| @Override | ||
| public void returnSubchannel(Subchannel subchannel) { | ||
| CacheEntry prev = cache.get(subchannel.getAddresses()); |
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.
Return immediately if prev != null && prev.subchannel == subchannel
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.
Done.
| } | ||
|
|
||
| @VisibleForTesting | ||
| class ShutdownSubchannelTask implements Runnable { |
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.
nit: final
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.
Done.
zhangkun83
left a comment
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.
Thanks!
| Subchannel takeOrCreateSubchannel(EquivalentAddressGroup eag, Attributes defaultAttributes); | ||
|
|
||
| /** | ||
| * Returns a {@link Subchannel} to the pool. |
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.
Rephrased it to "Puts ... back".
|
|
||
| @Override | ||
| public void returnSubchannel(Subchannel subchannel) { | ||
| CacheEntry prev = cache.get(subchannel.getAddresses()); |
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.
Done.
| } | ||
|
|
||
| @VisibleForTesting | ||
| class ShutdownSubchannelTask implements Runnable { |
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.
Done.
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