What is a load balancer?

In short
A load balancer is a device or service that sits between users and a group of servers and spreads incoming traffic across them. This keeps any single server from being overloaded, helps the application stay available, and lets it handle spikes in demand.
A load balancer is a piece of software or hardware that stands in front of a group of servers. Users send their requests to the load balancer, and it decides which server should handle each request. Users usually never see this step. They only notice that the site stays fast and online.
Why teams use one
Modern applications can receive a huge number of requests at the same time. A single server has limited capacity, so most applications run on several servers that hold the same data. A load balancer spreads the work across them. This has three main benefits.
- Availability: if one server fails, the load balancer sends traffic to the servers that are still running.
- Scalability: during a sudden spike, such as a popular ticket sale, you can add capacity without changing how users reach the site.
- Performance: no single server gets overloaded, so responses stay quick.
Load balancing can also help with security. Spreading traffic across several systems makes it harder for an attacker to exhaust one machine. The documentation also notes that load balancers can add some protection against DDoS attacks, which are floods of traffic meant to overwhelm a service.
How it works
When a request arrives, the load balancer picks a server from the group and forwards the request to it. The choice follows a rule called an algorithm. Some common rules are:
- Round robin: send requests to each server in turn.
- Least connections: send the request to the server with the fewest active connections.
- Source IP hash: use the client's IP address to pick a server, so the same client tends to reach the same server.
- Consistent hashing: map clients and servers onto a ring so that adding or removing a server moves only a small share of clients.
Algorithms are often grouped as static or dynamic. Static methods use fixed information about each server, such as its capacity. Dynamic methods watch the current load and adjust while the system runs. Dynamic methods suit traffic that rises and falls unpredictably.
If a server goes down, the load balancer stops sending it requests and uses the rest of the group. Users may not notice anything happened.
Session persistence
Some tasks need every request from one user to reach the same server. A shopping cart is a good example. The items a user added should be on the server that handles the checkout. Keeping a client tied to one server is called session persistence. Without it, the servers must share and fetch the same information again and again, which slows things down.
Layer 4 and Layer 7
Load balancers work at different layers of the OSI model, a standard way of describing how network communication is organized. Two types are most common.
A Layer 4 load balancer decides based on network and transport information, such as IP addresses and TCP or UDP ports. It is fast because it does not look inside the request.
A Layer 7 load balancer reads application data, such as HTTP headers, cookies, or the requested URL. This lets it route requests by content, for example sending image requests to one group of servers and API requests to another. It does more work per request, but it makes smarter decisions.
Common mistakes
A load balancer is not a cure for every slow system. If all servers depend on the same slow database, adding more servers will not help much. Also remember that session persistence has a cost, because it makes traffic less evenly spread. Check the official glossary for more detail on the options before you choose one.
For a wider look at how servers and the network fit together, read the official documentation linked from this page, which covers the topic in more depth.
FAQ
Is a load balancer the same as a proxy?
A load balancer acts as a traffic proxy, meaning it receives requests on behalf of the servers behind it. What makes it a load balancer is that it spreads those requests across several servers.
Do I need a load balancer for a small website?
Not always. A single small site on one server does not need one. Once you run several servers or expect big traffic spikes, a load balancer becomes useful.
What happens to users if a server fails behind a load balancer?
The load balancer stops sending traffic to the failed server and routes requests to the servers that are still online. Users usually keep working without noticing.
What is the difference between static and dynamic load balancing?
Static load balancing uses fixed information about each server to split traffic. Dynamic load balancing watches the current load and adjusts while the system runs, which suits unpredictable traffic.
Sources
This page is based on the official documentation below. Read it for full detail.
Load balancer — official documentation ↗Load balancer in the news
Docker VMM Reaches General Availability in Docker Desktop 4.101
Docker has made Docker VMM generally available in Docker Desktop 4.101 for macOS, Windows and Linux. The company also published fixed Docker Hardened Images for Java4Shell and NGINX HTTP/2.
Five nginx flaws enable crashes and code execution; Cloudflare says its proxy blocks the HTTP/2 and HTTP/3 paths
F5 disclosed ten nginx vulnerabilities on November 18, 2026, including five memory corruption bugs from the nginx2root research. Proxied origins are shielded from several HTTP/2 and HTTP/3 attacks, but not from all of them.

