---
title: "What is Load Balancer &#038; How Load Balancing works?"
url: "https://www.tarikul.top/web/what-is-load-balancer-how-load-balancing-works/"
language: "en-US"
updated: "2025-08-06T18:04:18+00:00"
---

# What is Load Balancer &#038; How Load Balancing works?

###### What is a **Load Balancer**?

A **Load Balancer** is a system (hardware or software) that **distributes incoming network traffic** across multiple servers (also called **backend servers** or **nodes**) to ensure:

- **High availability**
- **Reliability**
- **Scalability**
- **Improved performance**

It acts as a **traffic manager**, sitting between clients and servers to evenly distribute load and avoid server overload.

---

### How Load Balancing Works

Here’s how the process works, step-by-step:

1. **Client Sends Request** A user (client) requests a web page, video, or API call.
2. **Load Balancer Receives Request** Instead of going directly to a specific server, the request first hits the **load balancer**.
3. **Request is Distributed Based on Algorithm** The load balancer uses a **load balancing algorithm** (explained below) to select one of the available backend servers.
4. **Forward to Server** The request is forwarded to the selected server, which processes it and sends the response back—either directly to the client or via the load balancer.
5. **Health Checks** Load balancers continuously **monitor server health**. If a server fails, it stops sending traffic to that server until it’s healthy again.

---

### Common Load Balancing Algorithms

1. **Round Robin** Sends each request to the next server in a rotating order.
2. **Least Connections** Sends requests to the server with the **fewest active connections**.
3. **IP Hash** Uses the client’s IP address to determine which server handles the request.
4. **Weighted Round Robin** Servers with higher capacity get more requests based on weight.
5. **Random** Sends traffic to a random server (simple but sometimes inefficient).

---

### Types of Load Balancers

| Type | Description |
| --- | --- |
| **Hardware** | Physical devices (e.g., F5, Cisco) used in enterprise settings |
| **Software** | Installed software like **HAProxy**, **Nginx**, or **Apache** |
| **Cloud-based** | Provided by cloud services like **AWS ELB**, **Azure Load Balancer**, etc. |

---

### Real-World Example

Suppose you have an online store with 3 servers:

- If 1,000 users come at once,
- The load balancer might split them:

  - 334 to Server A
  - 333 to Server B
  - 333 to Server C

If Server B crashes, the balancer routes all traffic to A and C only.

---

### Benefits of Load Balancing

**Security** – Acts as a shield (in some setups).

**Redundancy** – Prevents downtime if one server fails.

**Scalability** – Easily add or remove servers.

**Performance** – Distributes workload efficiently.
