Layer 4 vs Layer 7 load balancing.
also: Layer 7 load balancing · Layer 4 load balancing · Layer 7 load balancer · Layer 4 load balancer · L7 load balancer · L4 load balancer · L7 load balancing · L4 load balancingL4 balancers route by IP and port without reading the payload; L7 balancers read HTTP and route by path, headers or cookies.
the two-minute refresher
- Layer 4 = transport (TCP/UDP): sees IPs and ports only, very fast, protocol agnostic.
- Layer 7 = application (HTTP): can route /api to one pool and /static to another, use cookies, rewrite headers.
- L7 must terminate TLS to read requests; L4 can pass encrypted traffic straight through.
- Rule of thumb: L4 for raw speed and non-HTTP protocols, L7 for smart HTTP routing.