|
| 1 | +--- |
| 2 | +title: Load Balancing |
| 3 | +description: How Linkerd implements load balancing. |
| 4 | +--- |
| 5 | + |
| 6 | +Linkerd uses a sophisticated |
| 7 | +[EWMA load balancing algorithm](../features/load-balancing.md) which typically |
| 8 | +requires no configuration or tuning. However, it also supports special handling |
| 9 | +for backends which support rate limiting. This special handling can be enabled |
| 10 | +with Service annotations. |
| 11 | + |
| 12 | +## Load Biaser |
| 13 | + |
| 14 | +When backends implement rate limiting and return |
| 15 | +[HTTP 429](https://www.rfc-editor.org/rfc/rfc6585.html#page-3) or |
| 16 | +[gRPC RESOURCE_EXHAUSTED](https://grpc.github.io/grpc/core/md_doc_statuscodes.html) |
| 17 | +by default, the proxy treats these as successful responses from a load balancing |
| 18 | +perspective. Since these types of responses are typically very fast, Linkerd’s |
| 19 | +[EWMA load balancing](https://linkerd.io/docs/features/load-balancing/) may |
| 20 | +actually send more traffic to these rate-limited endpoints. This can create a |
| 21 | +feedback loop where clients experience high 429 or RESOURCE_EXHAUSTED rates. |
| 22 | + |
| 23 | +Linkerd can be configured to use a more sophisticated version of the EWMA load |
| 24 | +balancing algorithm which takes rate-limit responses (HTTP 429 or gRPC |
| 25 | +RESOURCE_EXHAUSTED) into account. |
| 26 | + |
| 27 | +To enable Linkerd to use the Load Biaser for a Service, set the following |
| 28 | +annotation on the Service resource: |
| 29 | + |
| 30 | +{{< keyval >}} |
| 31 | + |
| 32 | +| annotation | value | |
| 33 | +| ------------------------------------------------------- | -------------------------------------------------------------------------------------- | |
| 34 | +| `balancer.alpha.linkerd.io/penalize-failures` | Enables the Load Biaser for this Service. Defaults to `false`. | |
| 35 | +| `balancer.alpha.linkerd.io/load-biaser-penalty` | The latency value to inject for rate-limited responses and failures. Defaults to `5s`. | |
| 36 | +| `balancer.alpha.linkerd.io/load-biaser-max-retry-after` | The maximum allowed value of a Retry-After header. Defaults to `300s`. | |
| 37 | + |
| 38 | +{{< /keyval >}} |
0 commit comments