LOG IN SIGN UP
Documentation

Directors

  Last updated November 28, 2018

Fastly's directors contain a list of backends to direct requests to. Traffic is distributed according to the specific director policy.

Healthcheck probes should be defined for backends within directors so the director can check the backend health state before sending a request. Directors will not send traffic to a backend that is identified as unhealthy.

Random director

The random director selects a backend randomly from the healthy subset of backends.

Each backend has a .weight attribute that indicates the weighted probability of the director selecting the backend.

The random director has the following properties:

In the following example, the random director will randomly select a backend with equal probability. At minimum, two backends must be healthy for their cumulative weight (~ 66%) to exceed the 50% quorum weight and qualify the director as healthy. If only one backend is healthy and the quorum weight is not reached, a "Quorum weight not reached" error will be returned to the client. If the random director fails to connect to the chosen backend, it will retry randomly selecting a backend up to three times before indicating all backends are unhealthy.

1
2
3
4
5
6
7
director my_dir random {
    .quorum = 50%;
    .retries = 3;
    { .backend = F_backend1; .weight = 1; }
    { .backend = F_backend2; .weight = 1; }
    { .backend = F_backend3; .weight = 1; }
}

Round-robin director

The round-robin director will send requests in a round-robin fashion to each healthy backend in its backend list.

In the following example, the round-robin director will send its first request to F_backend1, second request to F_backend2, third request to F_backend3, fourth request to F_backend1, and so on.

1
2
3
4
5
director my_dir round-robin {
    { .backend = F_backend1; }
    { .backend = F_backend2; }
    { .backend = F_backend3; }
}

Fallback director

The fallback director always selects the first healthy backend in its backend list to send requests to.

In the following example, the fallback director will send all requests to F_backend1, until its health status is unhealthy. If F_backend1 becomes unhealthy, the fallback director will send all requests to F_backend2 until F_backend1 is healthy again. If F_backend1 and F_backend2 both become unhealthy, the fallback director will send all requests to F_backend3 until either one of the previous backends become healthy again.

1
2
3
4
5
director my_dir fallback {
  { .backend = F_backend1; }
  { .backend = F_backend2; }
  { .backend = F_backend3; }
}

Back to Top