Load Balancing
Load balancing distributes incoming traffic across multiple healthy backend servers so that no single machine becomes a bottleneck. It improves availability, enables horizontal scaling, and is one of the first building blocks mentioned in real-world system design interviews.
Reading time
10 min
Types of Load Balancers
Hardware Load Balancers
Dedicated physical appliances built for traffic distribution. High throughput and low latency but expensive, inflexible, and hard to scale. Common in legacy enterprise environments.
Software Load Balancers
Run on commodity servers. Examples include Nginx, HAProxy, and Envoy. Highly configurable, cost-effective, and easy to deploy. Preferred by most modern infrastructure teams.
Cloud-Native Load Balancers
Fully managed services from cloud providers such as AWS ALB/NLB, GCP Cloud Load Balancing, and Azure Load Balancer. Integrate natively with autoscaling and observability tooling with zero infrastructure management.
DNS Load Balancers
Distribute traffic by returning different IP addresses in DNS responses. Simple to set up globally but limited by TTL caching, making failover slow and distribution imprecise.
Global Server Load Balancers (GSLB)
Operate across multiple data centers or regions using anycast routing or DNS-based steering. Critical for disaster recovery and latency-sensitive applications with a global user base.
Layer 4 Load Balancers
Work at the transport layer, routing traffic based on IP and TCP/UDP port only. Fast and lightweight since they skip packet inspection, ideal for raw throughput.
Layer 7 Load Balancers
Work at the application layer, inspecting HTTP headers, paths, cookies, and query params. Enable advanced routing like path-based routing, canary deployments, and A/B testing.
Interview Tip
When comparing load balancer types, anchor your answer on two axes: where in the OSI model it operates, and who manages the infrastructure. That covers L4 vs L7, hardware vs software, and self-managed vs cloud-native in one clean mental model.