-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add custom balancer to always remove subConns #15701
Conversation
a79dbc3
to
4b43407
Compare
cc1a028
to
eed6393
Compare
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 work, @kisunji 🙌🏻
I'm hoping to have the 1.15+ balancer (PR in enterprise repository) ready to merge in the next couple of days. Should we merge yours into main and then have my PR remove it, or somehow just merge yours into the 1.13 and 1.14 release branches?
b5f20f6
to
0c4d7f5
Compare
// | ||
// [1]: https://github.com/grpc/grpc-go/blob/v1.49.x/pickfirst.go | ||
|
||
/* |
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.
Is this just present here for reference, or is it executed?
If the former you could add a build tag to make it more obvious +build reference-only
for example.
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.
It's executed unfortunately
Thanks! I think I should merge to main first and backport so we have traceability if someone happens to git log -S for it. |
} | ||
|
||
if b.subConn != nil { | ||
b.cc.UpdateAddresses(b.subConn, state.ResolverState.Addresses) |
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.
Context for reviewers: this line does not close a connection if the active subConn
is in the list of state.ResolverState.Addresses
. This is the behavior that resolver.go
tried to work around by calling UpdateState
with a single address to close the connection (unless it happened to be the active one) and again to re-add the rest of the addresses.
I am new to load balancing of gRPC and having two basic question
will the PR resolve this nil pointer? |
|
03a0aa5
to
c2b35e7
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@kisunji , thanks for the explanation. The error message containing was observed in the main. I will give this branch a try today. |
While testing I encountered rare WARN logs at startup and occasionally if I leave a cluster running overnight. After some debugging I raised a separate issue #15821 which I consider out of scope for now. This PR should eliminate the biggest source of WARN logs but not all. |
@kisunji Could we add labels to backport to 1.14, 1.13 and 1.12? |
c2b35e7
to
aa2d5fd
Compare
aa2d5fd
to
ec1b87a
Compare
The new balancer is a patched version of gRPC's default pick_first balancer which removes the behavior of preserving the active subconnection if a list of new addresses contains the currently active address.
The new balancer is a patched version of gRPC's default pick_first balancer which removes the behavior of preserving the active subconnection if a list of new addresses contains the currently active address.
Fixes #10603
Description
Remove the need to call
UpdateState
twice by changing thepick_first
balancer's behavior to close existing connections (almost) every time.Testing & Reproduction steps
No net-new behavior; existing test
TestClientConnPool_IntegrationWithGRPCResolver_Rebalance
is still passing.Manually tested with frequent rebalancing
PR Checklist