客户端负载均衡

配置

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

已实现负载均衡器

自定义balance

  • 实现如下接口

// 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
}

实现

最后更新于