From 591a32b03fcba3ca63c4e6950ed5946965056c55 Mon Sep 17 00:00:00 2001 From: Phil Cameron Date: Fri, 20 Oct 2017 11:09:02 -0400 Subject: [PATCH] Router - changes to A/B weights discussion Bug: 1477685 https://bugzilla.redhat.com/show_bug.cgi?id=1477685 Trello: BhWCH3vu https://trello.com/c/BhWCH3vu/543-3-fix-problem-in-a-b-weight-algorithm --- architecture/topics/alternate_backends_weights.adoc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/architecture/topics/alternate_backends_weights.adoc b/architecture/topics/alternate_backends_weights.adoc index 1456e3124a47..0fd4c93a2230 100644 --- a/architecture/topics/alternate_backends_weights.adoc +++ b/architecture/topics/alternate_backends_weights.adoc @@ -3,22 +3,23 @@ A route is usually associated with one service through the `to:` token with the service based on the xref:load-balancing[load balancing strategy]. It is possible to have as many as four services supporting the route. The -portion of requests that are handled by each service is governed by the service +portion of requests that are handled by each service is governed by the service `weight`. The first service is entered using the `to:` token as before, and up to three additional services can be entered using the `alternateBackend:` token. Each service must be `kind: Service` which is the default. -Each service can have a `weight` associated with it. The portion of requests +Each service has a `weight` associated with it. The portion of requests handled by the service is `weight` / `sum_of_all_weights`. When a service has more than one endpoint, the service's weight is distributed among the endpoints with each endpoint getting at least 1. If the service `weight` is 0 each -endpoint will get 0. +of the service's endpoints will get 0. The `weight` must be in the range 0-256. The default is 1. When the `weight` is 0 no requests are passed to the service. If all services have `weight` 0, -requests are returned with a 503 error. +requests are returned with a 503 error. When a sevice has no endpoints, the weight +is effectively 0. When using `alternateBackends` also use the `roundrobin` xref:load-balancing[load balancing strategy] to ensure requests are distributed @@ -59,4 +60,5 @@ spec: <2> The first service name is `service-name` which may have 0 or more pods <3> The alternateBackend services may also have 0 or more pods <4> The total `weight` is 40. `service-name` will get 20/40 or 1/2 of the requests, -`service-name2` and `service-name3` will each get 1/4 of the requests. \ No newline at end of file +`service-name2` and `service-name3` will each get 1/4 of the requests, assuming each +service has 1 or more endpoints.