Interview kitsBlog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2026 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Cloud
Cloudmedium

L4 vs L7 load balancer — what’s the difference?

Tags
#load-balancer#l4#l7#networking
Back to categoryPractice quiz

Answer

L4 works on transport (TCP/UDP) and routes connections without understanding HTTP. L7 understands application protocols (HTTP) so it can route by path/headers, do TLS termination, and apply more advanced rules.

Advanced answer

Deep dive

The difference is what the load balancer understands.

L4 (transport)

  • Routes based on IP/port and TCP/UDP connection info.
  • Doesn’t inspect HTTP paths/headers.
  • Often lower overhead and works for non-HTTP protocols.

L7 (application)

  • Understands HTTP/HTTPS (and often gRPC/WebSockets).
  • Can do host/path/header-based routing, TLS termination, redirects, and WAF-like rules.
  • Enables features like rate limiting and advanced health checks (depending on the product).

Practical guidance

  • Use L7 for most web apps (routing, TLS termination, HTTP features).
  • Use L4 for raw TCP/UDP services or when you want minimal overhead.

Common pitfalls

  • Terminating TLS in the wrong place (visibility vs end-to-end encryption).
  • Not preserving client IP (use `X-Forwarded-For`/proxy protocol when needed).
  • Assuming every L7 supports every protocol feature (verify WebSocket/gRPC support).

Related questions

Cloud
Public vs private subnet: what’s the difference and why use a NAT?
#cloud#networking#subnet
Cloud
Kubernetes Service vs Ingress vs LoadBalancer: what does each do?
#kubernetes#networking#ingress
Cloud
What is a NAT gateway and when do you need it?
#cloud#networking#nat
Cloud
Public vs private subnet: what is the difference (in practice)?
#cloud#networking#subnet
Cloud
What is a VPC (virtual private cloud) and why do you need it?
#cloud#networking#vpc
Cloud
Health checks: what are they and why do load balancers need them?
#health-check#load-balancer#availability