Book a call Free rebuild
Home/Glossary/Hosting/Load Balancer

Load Balancer

August 25, 2022 Updated November 16, 2026 3 min read

Hosting glossaryA load balancer spreads incoming traffic across several servers so no single one is overwhelmed, and routes around servers that fail.

A load balancer sits between visitors and a group of servers that can all answer the same requests. Each incoming request goes to the load balancer first, which picks a server to send it to. Visitors see one address; behind it, two, ten, or a hundred servers share the work. That lets a site handle more traffic than one machine could, and keeps it online when one server fails.

How it works

The load balancer runs regular health checks against each server, for example requesting a status page every few seconds. A server that stops answering correctly is taken out of rotation until it recovers, and new servers can be added to the pool without downtime.

To decide where each request goes, it uses an algorithm:

  • Round robin: each server in turn. Simple, but it ignores how busy each one is.
  • Weighted round robin: larger servers get a bigger share.
  • Least connections: the server with the fewest active connections, which copes better when requests vary in cost.
  • Least response time: the server answering fastest, often combined with connection counts.
  • IP hash or session affinity ("sticky sessions"): the same visitor keeps reaching the same server, for applications that store session data locally.

Layer 4 and layer 7

A layer 4 load balancer routes by IP address and port without reading the request, which makes it fast and protocol-agnostic. A layer 7 load balancer understands HTTP, so it can route by domain, path, or header, terminate HTTPS, and add or rewrite headers. Most website load balancers work at layer 7.

Types

  • Software: NGINX, HAProxy, and similar, running on ordinary servers.
  • Managed cloud services: load balancers offered by cloud providers and CDNs, with no servers to maintain.
  • Hardware appliances: dedicated devices, mostly in enterprise data centers.
  • DNS or global load balancing: spreads traffic across regions or data centers, often combined with one of the above inside each region.

A load balancer is itself a kind of reverse proxy server. Make sure it is not a new single point of failure: managed services are redundant by design, and self-hosted ones are usually run in pairs.

Load balancing WordPress

WordPress can run behind a load balancer, but every web server must behave identically:

  • All servers use the same database, or a primary database with read replicas.
  • Uploads live on shared storage or are offloaded to object storage, so an image uploaded on one server exists on all of them.
  • A shared object cache such as Redis replaces each server's local cache.
  • Code is deployed to every server at once, so plugin and theme updates come from a deployment process rather than the dashboard of one server.

One gotcha catches many setups: when the load balancer handles HTTPS and talks to the servers over plain HTTP, WordPress thinks the request is insecure and can loop redirecting to HTTPS. The fix is to trust the X-Forwarded-Proto header from the load balancer and set $_SERVER['HTTPS'] in wp-config.php. The visitor's real IP address arrives in X-Forwarded-For, which security and analytics plugins need to be told about.

Most sites never need this. Good caching and a CDN let one well-sized server handle a great deal of traffic; load balancing pays off when a site needs more capacity than that, or cannot afford the downtime of a single server failing.

HostList

The hosting directory with no paid rankings.

Compare 30,000+ web hosts and MSPs across 120+ countries, ranked by HRI, an independent 0 to 100 rating built from verified data. Find your perfect web host.