jargon

Comparison

Layer 4 load balancingvsLayer 7 load balancing

Layer 4 load balancing

the balancer picks a backend per TCP connection and never looks inside, so it cannot route on a path or retry a request.

Distributing traffic by connection at the transport layer, without parsing what is being carried. It is fast, protocol-agnostic and cheap, and it is blind: no path-based routing, no header inspection, no per-request retry, and no rebalancing of a connection once established. That last property is why one long-lived multiplexed connection sends every request to a single backend regardless of load.

Full entry →

Layer 7 load balancing

the proxy reads the request, routes on the path, retries the failed one on another backend and adds a trace header.

Distributing traffic per request at the application layer, which requires terminating and parsing the protocol. It buys path and header routing, per-request balancing, retries, timeouts, rewriting and observability, and it costs CPU, latency and the need to handle certificates. Nearly everything a service mesh or an ingress does that sounds clever is this distinction and nothing more.

Full entry →

Related comparisons