Skip to content

Add ExitIdle method in balancer.Balancer interface #8345

@arjan-bal

Description

@arjan-bal

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.

Metadata

Metadata

Assignees

Labels

Area: Resolvers/BalancersIncludes LB policy & NR APIs, resolver/balancer/picker wrappers, LB policy impls and utilities.Type: API ChangeBreaking API changes (experimental APIs only!)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions