Skip to content

Add ExitIdle method in balancer.Balancer interface #8345

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

Open
2 tasks done
arjan-bal opened this issue May 21, 2025 · 0 comments · May be fixed by #8367
Open
2 tasks done

Add ExitIdle method in balancer.Balancer interface #8345

arjan-bal opened this issue May 21, 2025 · 0 comments · May be fixed by #8367
Assignees
Labels
Area: Resolvers/Balancers Includes LB policy & NR APIs, resolver/balancer/picker wrappers, LB policy impls and utilities. Type: API Change Breaking API changes (experimental APIs only!)

Comments

@arjan-bal
Copy link
Contributor

arjan-bal commented May 21, 2025

There is an ExitIdler interface that was added four years ago, which includes the ExitIdle method:

// ExitIdler is an optional interface for balancers to implement. If
// implemented, ExitIdle will be called when ClientConn.Connect is called, if
// the ClientConn is idle. If unimplemented, ClientConn.Connect will cause
// all SubConns to connect.
//
// Notice: it will be required for all balancers to implement this in a future
// release.
type ExitIdler interface {
// ExitIdle instructs the LB policy to reconnect to backends / exit the
// IDLE state, if appropriate and possible. Note that SubConns that enter
// the IDLE state will not reconnect until SubConn.Connect is called.
ExitIdle()
}

This is an optional interface that LB (load balancer) policies can implement. The ExitIdle method is called by the channel to transition the LB policy out of Idle mode when the channel is connected but no RPC has been made (i.e., the picker hasn't been called). If a top-level LB policy doesn't implement ExitIdler, the gracefulswitch balancer invokes Connect on all subchannels created by the LB policy.

As noted in the interface's godoc, “it will be required for all balancers to implement this in a future release.” Recently, we discovered potential bugs that can occur when a tree of LB policies is used and the parent LB implements ExitIdler but a child LB does not. To address this, we’ve decided to move ExitIdle into the Balancer interface directly.

This is a breaking change. However, since the balancer package is marked experimental and it has been four years since ExitIdler was introduced, we believe this change is acceptable.

We will fix some known projects that implement their own LB policies and wait for their releases before making the change in gRPC.

@arjan-bal arjan-bal self-assigned this May 21, 2025
@arjan-bal arjan-bal added Type: API Change Breaking API changes (experimental APIs only!) Area: Resolvers/Balancers Includes LB policy & NR APIs, resolver/balancer/picker wrappers, LB policy impls and utilities. labels May 21, 2025
@arjan-bal arjan-bal linked a pull request May 28, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Resolvers/Balancers Includes LB policy & NR APIs, resolver/balancer/picker wrappers, LB policy impls and utilities. Type: API Change Breaking API changes (experimental APIs only!)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant