Um momento
0x10Lesson 2 of 6

Compare Layer 4 and Layer 7 balancing

Choose between connection-level routing and application-aware routing.

12 min 5-question quiz
By the end of this lesson you can
  • Explain what transport and application-layer balancers can inspect and control.

Layer 4 balancing uses transport information such as IP addresses, protocol, and ports. It can route TCP or UDP flows without interpreting application requests. Layer 7 balancing understands protocols such as HTTP and can route by host, path, header, or cookie, terminate TLS, and apply request-aware policies. That extra context brings more flexibility and more protocol work, configuration, and processing cost.

Python simulation · illustrative only
1request = {"host": "shop.example", "path": "/api/orders"}
2if request["path"].startswith("/api/"):
3    pool = "api-backends"
4else:
5    pool = "web-backends"
6print(pool)
Output
api-backends

This is an HTTP routing illustration. A Layer 4 device cannot select a backend based on an encrypted HTTP path unless the traffic is decrypted by a component that can inspect it.

Key takeaways

  • Layer 4 routes transport flows; Layer 7 can route application requests.

  • TLS must be terminated before encrypted HTTP paths can be inspected.

  • Choose the layer based on needed policy, protocol, and operational cost.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: