What Is a Load Balancer?

Category: Web Servers ยท Updated 2026-11-08

A load balancer is a system that sits in front of two or more servers and distributes incoming requests between them, so no single server carries all the traffic. It also checks server health and stops sending traffic to a server that is slow or has failed, which improves both performance and reliability compared to running everything on one machine.

The problem a load balancer solves

A single server has a limit on how many requests it can handle at once before it slows down or runs out of resources. A load balancer lets a site run the same application on multiple servers, called a pool or a backend group, and spreads requests across all of them. This increases total capacity, and it also adds redundancy: if one backend server fails, the load balancer can route around it while the rest keep serving traffic.

How a load balancer works, step by step

  1. A request arrives at the load balancer's public address instead of going directly to any one server.
  2. The load balancer runs periodic health checks against each backend server, for example requesting a status page every few seconds.
  3. Using a chosen algorithm, it picks a healthy backend to handle the new request.
  4. It forwards the request to that backend and relays the response back to the visitor.
  5. If a backend starts failing health checks, the load balancer removes it from rotation until it recovers.

Common load balancing algorithms

AlgorithmHow it picks a backend
Round robinCycles through each backend in turn, one after another
Least connectionsSends the request to whichever backend currently has the fewest active connections
Weighted round robinLike round robin, but stronger servers are given a larger share based on an assigned weight
IP hashUses the visitor's IP address to consistently send them to the same backend, useful for session persistence

Layer 4 vs. Layer 7 load balancing

A Layer 4 load balancer makes decisions based only on network information, such as IP addresses and TCP ports, without looking at the content of the request. A Layer 7 load balancer understands HTTP itself, so it can route based on the URL path, the domain name (host header) or cookies, and can also handle tasks like HTTPS termination. Layer 7 load balancing is more flexible but requires more processing per request.

Load balancer vs. reverse proxy

Every load balancer is a form of reverse proxy, but not every reverse proxy balances load. A basic reverse proxy might simply forward all traffic to one backend server to add caching or HTTPS, while a load balancer's specific job is spreading traffic across several equivalent backends and tracking their health. In practice, software such as Nginx and HAProxy, and most cloud providers' load balancing products, can do both jobs at once.

Do you need a load balancer?

A small site on a single VPS or shared hosting plan typically does not need one. A load balancer becomes worthwhile once a site outgrows a single server's capacity, needs to stay online if one server fails, or is scaled across multiple data center regions. Many cloud and VPS providers offer load balancing as an add-on service rather than something you have to build yourself.

Frequently asked questions

What is a load balancer in simple terms?

A load balancer is a system that spreads incoming website traffic across multiple servers instead of sending it all to one, so the site can handle more visitors and keep working if one server goes down.

What is the difference between a load balancer and a reverse proxy?

A reverse proxy forwards requests to one or more backend servers, often to add caching or HTTPS. A load balancer is a reverse proxy whose specific purpose is distributing traffic across multiple equivalent backend servers and monitoring their health.

What happens if a server behind a load balancer fails?

The load balancer detects the failure through its health checks, stops sending new requests to that server, and continues routing traffic to the remaining healthy servers until the failed one recovers.

Does a small website need a load balancer?

Usually not. A small or medium site on a single well-sized server or VPS typically does not need one. Load balancers become useful once traffic or reliability requirements exceed what one server can handle.

What is a sticky session in load balancing?

A sticky session is when the load balancer consistently sends the same visitor to the same backend server, usually based on their IP address or a cookie, which keeps session data valid when it is stored only on one server.

Is a load balancer hardware or software?

Both exist. Dedicated hardware load balancers were once common in large data centers, but most sites today use software load balancers such as Nginx or HAProxy, or a managed load balancing service offered by a cloud or VPS provider.

Related topics