Light Dark Auto

Load Balancing

Configure load balancing

Load balancing dictates how requests are distributed across multiple instances of any given service. This document shows how to configure load balancing policies in Grey Matter.

Configuration Reference

To configure load balancing, the lb_policy field of the cluster object must be configured.

AttributeTypeDefaultDescription
lb_policy

string

least_request

How requests are distributed to instances of the cluster.

Detailed Configuration and Usage

lb_policy Options

ValueDescription
"least_request"

New requests will be sent to the instance with the fewest active requests.

"round_robin"

Requests will cycle through each "next" host in the available instances.

"ring_hash"

Ring Hash is one of the load balancer policies that does consistent hashing to upstream hosts, provided requests are made in a way that supplies a value to hash on. See the full explanation in the Envoy docs.

"random"

New requests will be sent randomly to a new host.

"maglev"

Maglev is another load balancer that performs consistent hashing to upstreams, but is dependent on hashable information available in the request. See more in the Envoy documentation.

Example cluster

{
  "zone_key": "default-zone",
  "cluster_key": "edge-service",
  "name": "edge",
  "instances": [],
  "circuit_breakers": {
    "max_connections": 500,
    "max_requests": 500
  },
  "lb_policy": "random",
  "outlier_detection": null,
  "health_checks": []
}

External Resources