# Load Balancer

A component that distributes incoming traffic across eligible service instances or locations.

- Type: term
- Domain: Engineering & architecture
- Level: Intermediate
- Last reviewed: 2026-09-24
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/load-balancer/>)

## What it means

A load balancer receives traffic through a stable address and selects one of several backend targets using health, capacity, location, connection, or scheduling information. Load balancing can operate at transport or application layers and at local or global scope. It distributes work; it does not create healthy capacity by itself.

## Why it matters

Distributing requests lets services use several instances, replace unhealthy targets, scale horizontally, and shift traffic during releases or regional disruption. The balancing policy directly affects latency, session behavior, utilization, and the size of failures users experience.

## When to use it

Use a load balancer when interchangeable service instances should share traffic or when routing must account for health and location. It adds little value for a single fixed target, and stateful workloads may require session, data-locality, or connection-aware designs beyond simple round robin.

## How it works

1. Expose a stable listener and register eligible backend targets or locations.
2. Run health checks that reflect whether each target can safely serve traffic.
3. Choose a routing algorithm based on connections, weight, locality, latency, or capacity.
4. Forward traffic while preserving the identity and protocol context the application needs.
5. Drain targets during deployments and remove unhealthy instances from selection.
6. Monitor target saturation, imbalance, health-check quality, errors, and added latency.

## A practical example

A collaboration service runs six stateless API instances across three zones. The load balancer removes one instance after failed health checks and drains two old instances during deployment, keeping existing connections stable while new traffic moves elsewhere.

## Where it breaks

Poor health checks can route traffic to broken targets or remove healthy ones. Uneven or stateful workloads may remain imbalanced, and the balancer itself needs capacity and redundancy. Distribution cannot compensate for a shared database bottleneck or universally broken release.

## Common mistakes

- Treating load balancing as automatic scalability without provisioning backend capacity.
- Using shallow health checks that pass while critical dependencies are unusable.
- Ignoring long-lived connections, session affinity, or graceful connection draining.
- Assuming equal request counts mean equal resource use.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/load-balancer/#visualization-load-balancer>)

## Sources

1. [What Is Elastic Load Balancing?](<https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/what-is-load-balancing.html>) — Amazon Web Services · Official technical documentation
2. [Cloud Load Balancing Overview](<https://cloud.google.com/load-balancing/docs/load-balancing-overview>) — Google Cloud · Official technical documentation

## Related topics

- [API Gateway](<https://wiki.soroush.uk/topic/api-gateway/>)
- [Content Delivery Network \(CDN\)](<https://wiki.soroush.uk/topic/content-delivery-network/>)
- [Service-Level Indicator](<https://wiki.soroush.uk/topic/service-level-indicator/>)
