Client-side load balancing is a load balancing approach in which the calling application itself selects which backend instance receives each request, instead of sending traffic to a dedicated proxy or appliance. The client obtains a list of healthy endpoints from a service registry, DNS or a control plane, applies a selection algorithm locally and connects directly to the chosen server.
The pattern is common in microservice architectures and modern networking stacks such as gRPC, where thousands of services call each other at high rates. Removing the central load balancer eliminates one network hop and one potential bottleneck, but it moves responsibility for health awareness, retry logic and fairness into every client library.
How client-side load balancing works
Client-side load balancing relies on three cooperating functions inside or beside the client: endpoint discovery, endpoint selection and feedback from observed results. Each request passes through these steps in a few microseconds, because no network round trip to an intermediary is required.
- Discovery retrieves the current set of instances from a registry such as Consul, etcd, ZooKeeper or Kubernetes endpoints, or through DNS SRV records.
- Health filtering removes instances that failed recent calls or were marked unhealthy by the registry.
- Selection applies an algorithm such as round robin, least outstanding requests or the power of two choices.
- Feedback records latency and errors so that later selections avoid slow or failing instances.
Because every client holds its own local view of the pool, decisions are made independently. This is efficient, but it also means that no single component sees the global load picture, which shapes almost every design trade-off of the pattern.
Comparison with server-side load balancing
The essential difference from server-side load balancing is where the routing decision is made. A conventional load balancer such as HAProxy, F5 BIG-IP or a cloud load balancer sits between clients and servers, while the client-side model distributes that logic across all callers.
The table below contrasts the two models across the properties that most often decide an architecture.
| Property | Client-side | Server-side |
|---|---|---|
| Network hops | Direct client to server | Extra hop through the proxy |
| Single point of failure | None in the data path | Proxy tier must be made redundant |
| Global load visibility | Partial, per client | Complete within the proxy |
| Language dependence | Library needed per language | Transparent to all clients |
| Policy changes | Rolled out to every client | Configured in one place |
| Trust boundary | Clients must be trusted | Suitable for untrusted clients |
As a rule, client-side balancing fits internal east-west traffic between services that a team controls, while server-side balancing remains the standard for public north-south traffic from browsers and third-party clients that cannot be required to run a specific library.
Selection algorithms used by clients
Clients can use the same algorithms as proxies, yet partial visibility changes how well each one performs. An algorithm that is optimal in a central proxy can create uneven load when hundreds of clients apply it independently.
This table summarizes the algorithms most often found in client libraries and their behavior when many clients act at once.
| Algorithm | Decision basis | Behavior with many clients |
|---|---|---|
| Round robin | Fixed rotation through the list | Even on average, blind to slow servers |
| Weighted round robin | Rotation scaled by capacity weights | Good for mixed instance sizes |
| Least outstanding requests | Fewest in-flight calls from this client | Uses only local counts |
| Power of two choices | Better of two random candidates | Avoids herding, near-optimal spread |
| Consistent hashing | Hash of a request key | Preserves cache affinity across clients |
| Latency-weighted (EWMA) | Moving average of response time | Reacts quickly to degraded instances |
The power of two choices is popular precisely because it tolerates stale information: picking the less loaded of two random instances avoids the herd effect in which every client simultaneously sends traffic to the same apparently idle server.
Implementations and deployment models
Client-side load balancing appears in three main deployment forms, which differ in where the logic runs and how it is updated. The choice determines operational effort far more than the algorithm itself.
| Form | Where logic runs | Typical examples |
|---|---|---|
| Embedded library | Inside the application process | gRPC load balancing policies, Spring Cloud LoadBalancer |
| Sidecar proxy | Local proxy next to each instance | Envoy Proxy in a service mesh |
| Proxyless mesh | Library configured by a control plane | gRPC with the xDS protocol |
Strictly speaking, a sidecar is a local proxy rather than the client code, yet it is usually grouped with client-side balancing because each caller still makes its own routing decision without a shared central tier. The xDS protocol, originally created for Envoy, lets a control plane push endpoint lists and policies to both sidecars and proxyless clients.
Limitations and operational risks
The main weaknesses of client-side load balancing stem from distributed, uncoordinated decisions. Teams adopting the pattern should plan for the following risks before rollout.
- Stale endpoint lists send traffic to terminated instances when discovery updates lag behind autoscaling events.
- Long-lived connections, especially HTTP/2 used by gRPC, pin traffic to old instances unless clients periodically rebalance or servers set a maximum connection age.
- Library drift across languages and versions produces inconsistent retry and timeout behavior.
- Retry storms occur when many clients retry simultaneously against a recovering service; retry budgets and jittered backoff are essential safeguards.
- Uneven aggregate load appears when a few large clients dominate traffic, because each balances only its own share.
Mitigation usually combines active health checks, outlier detection and connection draining coordinated through the registry. Observability matters as well: per-instance request counts collected from the servers reveal imbalances that no individual client can detect.
In everyday language
Imagine a supermarket with many checkout lanes. In one store, an employee at the entrance points each shopper to a lane. In another, shoppers look at the lanes themselves and pick the shortest one. Client-side load balancing is the second store. Each customer decides where to go, so nobody needs to wait for the employee.
This saves time and removes a single person who could become overwhelmed. The catch is that shoppers only see part of the picture. If everyone rushes to the same empty lane at once, it fills up instantly. Good rules for choosing a lane keep the crowd spread out evenly.
Seen in the real world
An online travel platform runs a pricing service as 40 instances in Kubernetes, called by a search service over gRPC at about 25,000 requests per second. Initially, all traffic went through a Layer 4 load balancer, but because gRPC keeps long-lived HTTP/2 connections, a handful of instances received most of the requests while new instances stayed nearly idle after each scale-out.
The engineering team switched the search service to client-side load balancing with gRPC, using DNS to discover pod addresses and a least-request policy per call. They also configured a maximum connection age of five minutes on the servers so clients reconnect and pick up new instances. CPU usage across the pricing pods converged within a narrow band, and the 99th percentile response time dropped from 180 ms to 70 ms without adding any hardware.