Layer 4 Load Balancer
Definition
Load balancer that works at the transport layer, routing traffic based only on IP address and port number without looking at the content.
Use Cases
- Cloudflare: Load balancing and proxying large volumes of TCP/UDP traffic at the edge (e.g., Spectrum for non-HTTP applications). — Uses L4 proxying and load distribution to steer connections to healthy origins while keeping latency low; health checks and anycast routing are used to keep traffic close to users. (Improved availability and resilience for non-HTTP services while handling high connection volumes with low overhead.)
- Netflix: High-scale service-to-service traffic and edge traffic patterns that require efficient connection handling and minimal latency. — Uses load balancing patterns and infrastructure components designed for high throughput and resilience; L4-style balancing is commonly used for TCP-based services where content inspection is not required. (Supports large-scale traffic with strong reliability characteristics and efficient connection management.)
Provider Equivalents
- AWS: Network Load Balancer (NLB)
- Azure: Azure Load Balancer
- GCP: Cloud Load Balancing (TCP/UDP Network Load Balancer)
- OCI: OCI Network Load Balancer
Frequently Asked Questions
- What's the difference between a Layer 4 load balancer and a Layer 7 load balancer?
- A Layer 4 load balancer routes connections based on network and transport info like IP address, port, and protocol (TCP/UDP). It doesn’t look inside the application data. A Layer 7 load balancer understands application protocols like HTTP/HTTPS and can route based on URL path, host header, cookies, or other request content—useful for web apps and API routing.
- When should I use a Layer 4 load balancer?
- Use Layer 4 when you need very high performance and low latency, when you’re balancing non-HTTP protocols (TCP/UDP), or when you want end-to-end encryption pass-through (TLS terminates on the backend). Common examples include gaming (UDP), VoIP, MQTT, database proxies, and high-throughput TLS pass-through on port 443.
- How much does a Layer 4 load balancer cost?
- Pricing usually depends on (1) hours the load balancer runs, (2) number of connections or new connections per second, (3) processed bytes/throughput, and (4) optional features like static IPs, cross-zone balancing, or private connectivity. Exact costs vary by cloud and region, so estimate using the provider’s pricing calculator with your expected traffic volume and connection rate.
Category: networking
Difficulty: advanced
Related Terms
See Also