Skip to main content

Load Balancer

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/load-balancer

In short

A load balancer is a server or service that spreads incoming traffic across several backend servers so no single one is overloaded and the app stays available.

What is a load balancer?

A load balancer sits in front of a group of servers and decides which one should handle each incoming request. By spreading the work, it lets an application serve more users than any single server could, and it keeps the application available when one server fails or is taken down for maintenance.

Load balancers choose a server using an algorithm such as round robin (each server in turn), least connections (the least busy server), or a hash of the client's IP address, so the same user keeps reaching the same server. They also run health checks, sending regular test requests to every backend and automatically removing any server that stops responding. A layer 4 load balancer routes traffic using only IP addresses and ports, while a layer 7 load balancer understands HTTP and can route by URL path, headers, or cookies.

Picture a supermarket with several checkout lanes and an employee directing each shopper to the shortest line; if a lane closes, shoppers are simply sent to the others. Load balancers can be dedicated hardware appliances, software such as NGINX, HAProxy, and Envoy, or managed services from cloud providers. In Kubernetes, a Service of type LoadBalancer asks the platform to create one in front of your pods.

Load balancers are often confused with reverse proxies. A reverse proxy is any server that receives requests on behalf of backend servers, and spreading those requests across several backends is one job it can do, so tools like NGINX often play both roles at once. However, some load balancers work only at the network level and forward connections without reading the HTTP requests inside them.

At a glance

Three clients send requests to a load balancer, which spreads them across servers 1 and 3 and skips server 2 because it fails its health check.ClientClientClientLoad balancerround robinServer 1Server 2fails health checkServer 3
The load balancer spreads requests across the healthy servers and automatically takes a failing one out of rotation.

Key takeaways

  • A load balancer distributes requests across multiple servers.
  • Health checks automatically take failing servers out of rotation.
  • Common algorithms include round robin, least connections, and IP hash.
  • Layer 4 balancing uses IP addresses and ports; layer 7 understands HTTP.
  • Load balancing enables horizontal scaling and high availability.

Example

Load balancing three app servers with NGINXnginx
# The pool of backend servers that share the traffic
upstream app_servers {
    least_conn;              # send each request to the least busy server
    server 10.0.0.11:3000;
    server 10.0.0.12:3000;
    server 10.0.0.13:3000;
}

server {
    listen 80;
    location / {
        proxy_pass http://app_servers;
    }
}

Readers ask

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

A reverse proxy accepts client requests and forwards them to backend servers, often adding caching, compression, or TLS termination. A load balancer focuses on spreading traffic across several backends; many reverse proxies can load balance, and many load balancers act as reverse proxies.

What is a sticky session?

A sticky session, or session affinity, means the load balancer sends all requests from the same user to the same backend server, usually based on a cookie or the client's IP address. It helps when servers keep session data in memory, but storing sessions in a shared cache or database scales better.

What happens if the load balancer itself fails?

A single load balancer can become a single point of failure, so production setups usually run two or more of them, with a shared floating IP address or DNS records that point to the healthy ones. Managed cloud load balancers handle this redundancy automatically.

Often compared

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings