Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Latest commit

 

History

History
39 lines (31 loc) · 1.48 KB

README.md

File metadata and controls

39 lines (31 loc) · 1.48 KB

gRPC Throughput Load Balancer GoDoc travis slack.cloudfoundry.org

The gRPC throughput load balancer is a load balancer that implements the grpc.Balancer interface. It will open a configured number of connections to a single address and not allow more than a given number of concurrent requests per address.

In your code when you make a gRPC request (stream or RPC), the gRPC throughput load balancer will return the connection with the least number of active requests.

Load Balancer Lifecycle

The order gRPC calls methods on the gRPC throughput load balancer are:

  1. Start
  2. Notify
  3. Up
  4. Get

Example

lb := throughputlb.NewThroughputLoadBalancer(100, 20)

conn, err := grpc.Dial(os.Getenv("GRPC_ADDR"),
    grpc.WithBalancer(lb))
if err != nil {
    panic(err)
}