FUNDAMENTALS & NETWORKING · SUBTOPIC
Layer 4 vs. Layer 7 Load Balancing
Compare packet-level speed (L4) against HTTP-aware smart routing (L7).
BeginnerPart of Load Balancing & Proxies
Subtopics in Load Balancing & Proxies (2)
In plain words
An L4 balancer checks only the envelope’s address and forwards it unopened at top speed. An L7 balancer opens the letter, reads what you asked for, and hands it to the specialist department.
Think of it like…
Mailroom sorting by ZIP code (L4) vs. reading the subject line to route to Billing or Support (L7).
Loading interactive diagram
Loading interactive exercise
Theory & how it works
Why real systems often combine both
At massive scale, a fast Layer 4 load balancer (like AWS NLB or Linux IPVS) sits at the front edge and spreads raw TCP connections across a tier of Layer 7 proxies (like Envoy or NGINX), which then inspect HTTP paths and route to backend microservices.
Key points & practical guide
Summary checklist
- L4 = fast packet forwarding (IP/port)
- L7 = HTTP-aware routing, TLS termination, header inspection
- Use L4 + L7 together at high scale
When to use it
- L4 for raw TCP/WebSocket scale
- L7 for HTTP path routing, gRPC, and canary traffic splitting
Watch out for
- Expecting an L4 balancer to route
/apivs/static- it cannot see URLs
Quick check
Loading quiz