← Lessons

quiz vs the machine

Gold1400

Networking

The Elastic Load Balancer Types

Choosing between layer four and layer seven distribution.

5 min read · core · beat Gold to climb

Spreading The Load

A load balancer accepts incoming connections and spreads them across many backend targets. Cloud providers offer several types that operate at different layers of the network stack, and the right choice depends on what decisions you need to make about the traffic.

The Main Types

Each type trades features for speed and flexibility.

  • An application load balancer works at layer seven and can route by URL path, host header, or cookies.
  • A network load balancer works at layer four and forwards by IP and port at very high throughput.
  • A gateway load balancer inserts third party appliances such as firewalls into the traffic path.

Picking One

Use an application load balancer when you need content based routing for HTTP services. Reach for a network load balancer when you need extreme throughput, static IPs, or non HTTP protocols. The layer four option is faster because it does not parse application data.

Key idea

Application load balancers route on layer seven content like paths and headers, while network load balancers forward at layer four for raw speed and static IPs, so the choice follows whether you need to inspect application data.

Check yourself

Answer to earn rating on the learn ladder.

1. Which load balancer can route by URL path and host header?

2. Why is a network load balancer faster than an application load balancer?