Uh oh!
There was an error while loading. Please reload this page.
grpc: implement channel affinity - #494
Conversation
Codecov Report
@@ Coverage Diff @@## master #494 +/- ##
============================================
- Coverage 70.5% 70.43% -0.07% - Complexity 810 813 +3
============================================
Files 165 165 Lines 3773 3781 +8 Branches 289 293 +4 ============================================
+ Hits 2660 2663 +3 - Misses 990 992 +2 - Partials 123 126 +3
Continue to review full report at Codecov.
|
igorbernstein2
commented
Mar 12, 2018
Whoa, that was fast! |
| ManagedChannel getChannel(int affinity) { | ||
| int index = affinity % channels.size(); | ||
| index = Math.abs(index); | ||
| // If index is the most negative int, abs(index) is still negative. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| * reverse is not true: Two calls with different affinities might return the same channel. | ||
| * However, the implementation should attempt to spread load evenly. | ||
| */ | ||
| ManagedChannel getChannel(int affinity) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| private final CallOptions callOptions; | ||
| @Nullable private final Duration streamWaitTimeout; | ||
| @Nullable private final Duration streamIdleTimeout; | ||
| @Nullable private final Integer channelAffinity; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| return grpcContext.getChannel().newCall(descriptor, callOptions); | ||
| Channel channel = grpcContext.getChannel(); | ||
| if (grpcContext.getChannelAffinity() != null && channel instanceof ChannelPool) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| ManagedChannel getChannel(int affinity) { | ||
| int index = affinity % channels.size(); | ||
| index = Math.abs(index); | ||
| // If index is the most negative int, abs(index) is still negative. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| return grpcContext.getChannel().newCall(descriptor, callOptions); | ||
| Channel channel = grpcContext.getChannel(); | ||
| if (grpcContext.getChannelAffinity() != null && channel instanceof ChannelPool) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
pongad
commented
Mar 15, 2018
@vam-google Thank you for the review! |
Updates googleapis/google-cloud-java#3022.
cc @igorbernstein2 @hzyi-google