Client-side load balancing

Configuration

## client configurations
clients:
  ## client loadbalance, default: localityRoundRobin
  # loadbalance: "localityRoundRobin"
  ## grpc client configuration
  grpc:
    ## grpc client loadbalance
    # loadbalance: ""

Implemented load balancers

Custom balance

  • Implement the following interface

// Picker defines the interface that all custom load balancers must implement.
// It is a higher-level abstraction over gRPC's native balancer.Picker.
type Picker interface {
	// Pick selects a backend connection based on the pick information.
	Pick(info balancer.PickInfo) (*PickResult, error)

	// Name returns the name of the load balancing strategy (used in logs and headers).
	Name() string
}

Implementation

Last updated