# Load Balancer

import DocButton from '~/components/webkit/DocButton.vue';

Azion **Load Balancer** is a **Connectors** feature designed to balance traffic across your origins, data centers, or cloud providers, mitigating network congestion and server overload. To achieve high levels of fault tolerance and performance in case there are any issues with your origin servers, your content and applications must be available from multiple sources.

With Load Balancer, you can:

- Distribute traffic across your origin servers.
- Ensure the availability of your content and applications even in case of incidents.
- Choose between load balancing algorithms.
- Create routing rules to balance HTTP and HTTPS requests.

For more options on how to direct traffic to **Load Balancer** based on other criteria, see the [Rules Engine for Application](/en/documentation/products/build/applications/rules-engine/) page.

## Implementation

| Scope | Resource |
| --- | --- |
| Connectors | [Connectors](/en/documentation/products/secure/connectors/) |

---

## Balancing method

The balancing method defines how requests will be distributed, considering the availability of your origins (layer 3) and potential access errors, such as when the origin returns an HTTP STATUS 500 (layer 7).

:::note
**Load Balancer** will query the origins according to the balancing method and weight they're assigned. If an origin returns a `4xx` or a `5xx` error, or takes longer to respond than the [timeouts](/en/documentation/products/build/applications/origins/#timeouts) defined in the origin, the Load Balancer will override the balancing method and weight to query the remaining origins before returning an error to your users.

To customize this behavior, [contact the support team](https://tickets.azion.com/en/support/login).
:::

### Round-Robin

The **Round-Robin** balancing algorithm ensures an even distribution of traffic among origins in rotation. Instead of considering the response time of each origin, it focuses on the volume of requests.

Each origin receives a load in proportion to its assigned weight in the round-robin. While slower origins may accumulate more connections in parallel, the algorithm guarantees equitable load balancing across all origins.

### Least Connections

The **Least Connections** balancing algorithm monitors the active connections with each origin and consistently directs the next request to the origin with the fewest active connections. This approach optimizes load distribution by sending fewer requests to slower origins, while allowing faster origins to handle more requests in succession.

### IP Hash

The **IP Hash** balancing algorithm tracks user IP addresses and associates the same origin with each IP. By creating a consistent mapping between users and origins, this approach ensures that each user's requests are directed to the same origin server.

---

## Address

You may add more than one **Address** for your origin. Addresses in **Load Balancer** follow the same logic as a **Single Origin** address.

<DocButton href="/en/documentation/products/build/applications/origins/#address" label="Learn more about origin addresses" size="medium" />

---

## Weight

You may define a **Weight** for each address by assigning them a number from `1` to `10`.

The weight sets the proportion of load that the origin will receive. The larger the weight, the more load the origin will handle. For example, if you set the weight of an origin to 3, it will receive 3 times more load than an origin with a weight set to 1.

---

## Server Role

If you use the **Round-Robin** or **Least Connections** methods, you can define a **Server Role** for each origin:

- **Primary**: are the go-to origin for requests and will be prioritized over **Backup** origins.
- **Backup**: act as *standby* origins and only receive the load if all **Primary** origins fail.

---

## Active

In cases of maintenance or origin outages, you can disable an address temporarily from the balance. Turn off the **Active** switch and your server will become inactive, ensuring your infrastructure will smoothly undergo maintenance procedures without disrupting the overall performance.

:::caution
At least one active origin is required for the content to be available.
:::

---

## Limits

:::tip
**Increase limits** <br></br>
You can request to increase the limits. Contact the [technical support team](/en/documentation/services/support/) to request it.
:::

### Addresses

With **Load Balancer** active, you may create up to 10 origin addresses for each connector.