What Is Load Balancing and How Does It Work?
.png)
Load balancing refers to distributing incoming requests between multiple servers instead of directing all requests to just one of them. A special software solution that carries out such distribution is referred to as a load balancer. It sits in front of your servers, receives the requests, and redirects them.
There are two important things about it. First, no server gets overloaded with requests, and, second, in case one of the servers goes down, the load balancer identifies that and stops sending the traffic there. So your clients would not notice anything.

How does load balancing work?
- A request reaches the address of the load balancer.
- Health checks inform the balancer of which servers are online, and it skips the failed ones.
- The algorithm chooses a server among the healthy ones.
- The request is forwarded and the reply comes from the server back through the load balancer to the client.
- Optionally, it keeps a session on one server by means of a cookie or hashing if needed by the application.

Common load balancing strategies

The power of two choices is a popular technique in big systems. It selects two servers randomly and forwards the request to the less busy one. It provides almost the same effect as least connections without tracking the status of all servers.
Layer 4 vs Layer 7 load balancing
Cloud providers offer both types, like AWS Network Load Balancer and Application Load Balancer. In Kubernetes, a Service distributes the traffic between the pods, and an Ingress or Gateway API controller takes care of Layer 7 routing. NGINX, HAProxy, Envoy and Traefik are the typical open source solutions.
Load balancing for LLM and AI workloads
Model serving violates the assumptions of round robin. One request may return in 200 milliseconds, while the next may stream for a minute, and a replica with a long queue would look the same as an idle one if you count requests per turn.
- Balance on load, not turns. Route to the replica with the least in-flight requests or the shortest queue.
- Respect the cache. Sending the repeated prompt prefix to the replica that already has it would save some GPU processing. Some inference routers do that.
- Scale with demand. Combine the balancer with autoscaling so that new replicas would join the pool on load increase.
- Balance across providers as well. A gateway may distribute traffic among the model providers and switch off one provider when it becomes slow or rate-limited.
The TrueFoundry AI Gateway does this at the model layer. You define the models behind one endpoint, then configure weights, latency-based routing and fallbacks. Also see what is an AI gateway.
Challenges and best practices
- Avoid the single point of failure. Deploy the load balancer itself in pairs or use the managed one.
- Tune the health checks. Be careful about the check interval. If it is too long, the users would reach the failed servers. But if it is too aggressive, the healthy servers would be pulled down on a spike.
- Prefer stateless services. If every server can process any request, sticky sessions would seldom be required.
- Drain before deploying. Wait until the in-flight requests complete before decommissioning the server.
- Track the metrics. Monitor the server latency, error rate and connection counts, and review the stats after every scaling event.
Related: autoscaling, service mesh and scale to zero.

Govern, Deploy and Trace AI in Your Own Infrastructure
Frequently Asked Questions
What is load balancing in simple terms?
It is distributing incoming requests among a number of servers to prevent any one of them from being overwhelmed. A load balancer sits at the front, selects a healthy backend for every request, and keeps the application fast and available.
What are the main load balancing strategies?
Round-robin distributes requests equally among all backends, least-connections directs traffic to the least busy backend, and latency-based routing chooses the quickest-responding one. Load-aware strategies are best for variable workloads like LLM requests.
How does load balancing improve availability?
By running health checks and passing requests only to backends that are up and responsive. If one fails, the balancer sends traffic to the others, so the application keeps working instead of going down with a single server.
Why does load balancing matter for LLMs?
Because LLM replicas are expensive and scarce, and requests vary in cost. Balancing keeps replicas evenly and fully used, avoids overloading any one, and can route across models and providers to balance speed, cost, and reliability.
How is load balancing related to autoscaling?
Load balancing distributes traffic among the backends you have; autoscaling changes how many backends there are. In combination they let an application both use its current capacity well and add or remove capacity as demand changes.

















