Locality weighted load balancing
When all endpoints are available, the locality is picked using a weighted round-robin schedule, where the locality weight is used for weighting. When some endpoints in a locality are unavailable, we adjust the locality weight to reflect this. As with priority levels, we assume an (default value 1.4), which means we do not perform any weight adjustment when only a small number of endpoints in a locality are unavailable.
Assume a simple set-up with 2 localities X and Y, where X has a locality weight of 1 and Y has a locality weight of 2, L=Y 100% available, with default overprovisioning factor 1.4.
To sum this up in pseudo algorithms:
Note that the locality weighted pick takes place after the priority level is picked. The load balancer follows these steps:
Locality weighted load balancing is configured by setting locality_weighted_lb_config in the cluster configuration and by providing weights via and identifying the location of the upstream hosts via locality in .