---
# System prepended metadata

title: Load Balancing

---

# Load Balancing

It helps to spread the traffic across a cluster of servers to improve responsiveness and availability of applications, websites or databases. LB also keeps track of the status of all the resources while distributing requests. If a server is not available to take new requests or is not responding or has elevated error rate, LB will stop sending traffic to such a server.

![](https://i.imgur.com/jP28Ghl.png)

How does the load balancer choose the backend server?
two factors -> They will first ensure that the server they choose is actually responding appropriately to requests and then use a pre-configured algorithm to select one from the set of healthy servers.

1. 
* **Health Checks** - Load balancers should only forward traffic to “healthy” backend servers. To monitor the health of a backend server, “health checks” regularly attempt to connect to backend servers to ensure that servers are listening.

2. 
* **Least Connection Method** — This method directs traffic to the server with the fewest active connections. This approach is quite useful when there are a large number of persistent client connections which are unevenly distributed between the servers.

* **Least Response Time Method** — This algorithm directs traffic to the server with the fewest active connections and the lowest average response time.

* **Least Bandwidth Method** - This method selects the server that is currently serving the least amount of traffic measured in megabits per second (Mbps).

* **Round Robin Method** — This method sends each new request cycles through a list of servers. It is most useful when the servers are of equal specification and there are not many persistent connections.

* **Weighted Round Robin Method** — The weighted round-robin scheduling is designed to better handle servers with different processing capacities. Each server is assigned a weight (an integer value that indicates the processing capacity). Servers with higher weights receive new connections before those with less weights and servers with higher weights get more connections than those with less weights.

* **IP Hash** — Under this method, a hash of the IP address of the client is calculated to redirect the request to a server.