All systems operational System status

Azure 23 Sep 2026 9 min read

Azure Load Balancer vs Application Gateway: Technical Comparison

Azure Load Balancer vs Application Gateway explained with a technical comparison of Layer 4 and Layer 7 load balancing, routing, TLS termination, WAF, health probes, backend pools and common use cases.


Azure provides multiple load-balancing services, and two of the most commonly compared options are Azure Load Balancer and Azure Application Gateway.

Although both services distribute traffic across backend resources, they operate at different networking layers and are designed for different application architectures.

The most important distinction is simple:


Azure Load Balancer
        |
        v
Layer 4 - TCP / UDP
        |
        v
Backend Servers


Application Gateway
        |
        v
Layer 7 - HTTP / HTTPS
        |
        v
Application-aware Routing
        |
        v
Backend Servers
  

Understanding this difference helps you choose the appropriate service for your workload instead of treating both products as interchangeable.

What Is Azure Load Balancer?

Azure Load Balancer is a Layer 4 load-balancing service. It distributes network traffic based on transport-layer information such as IP addresses and TCP or UDP ports.

It is commonly used to distribute traffic across Azure virtual machines, Virtual Machine Scale Sets and other supported backend resources.


Client
   |
   v
Azure Load Balancer
   |
   +--------+--------+
   |        |        |
   v        v        v
 VM-01    VM-02    VM-03
  

Because it operates at Layer 4, the load balancer does not need to understand application-level HTTP content to distribute traffic.

What Is Azure Application Gateway?

Azure Application Gateway is a Layer 7 web traffic load balancer and application delivery service.

It can make routing decisions based on HTTP and HTTPS information such as hostnames, URLs and other HTTP characteristics.


                    Client
                      |
                      v
              Application Gateway
                      |
          +-----------+-----------+
          |                       |
          v                       v
   /api/* Backend          /images/* Backend
          |                       |
          v                       v
       API VMs              Web Servers
  

Application Gateway can also provide capabilities such as TLS termination, cookie-based session affinity and Web Application Firewall integration.

Layer 4 vs Layer 7

The biggest technical difference between the two services is the OSI layer at which traffic is handled.

Feature Azure Load Balancer Application Gateway
Primary Layer Layer 4 Layer 7
Traffic TCP / UDP HTTP / HTTPS
Application Awareness No HTTP-level awareness HTTP-aware
URL Routing No Yes
Host-Based Routing No Yes
TLS Termination Not its primary function Yes
WAF Integration No Yes
Web Application Routing Limited to transport-level traffic Advanced

Azure Load Balancer Architecture


                    Internet
                       |
                       v
              Public Load Balancer
                       |
              +--------+--------+
              |        |        |
              v        v        v
            VM-01    VM-02    VM-03
              |        |        |
              +--------+--------+
                       |
                 Application
  

The load balancer receives network traffic and distributes connections to healthy backend instances according to its configured rules and health probes.

Application Gateway Architecture


                    Internet
                       |
                       v
              Application Gateway
                       |
                HTTPS / HTTP
                       |
             +---------+---------+
             |                   |
             v                   v
         /api/*              /web/*
             |                   |
             v                   v
          API Pool           Web Pool
  

Application Gateway can inspect HTTP-level information and use routing rules to direct requests to appropriate backend pools.

URL-Based Routing

One of the major advantages of Application Gateway is URL path-based routing.


https://example.com/api/users
              |
              v
       Application Gateway
              |
              v
          API Backend


https://example.com/images/logo.png
              |
              v
       Application Gateway
              |
              v
         Image Backend
  

This type of application-aware routing is not the primary purpose of Azure Load Balancer.

Host-Based Routing

Application Gateway can route HTTP requests based on the requested hostname.


api.example.com
       |
       v
    API Pool


shop.example.com
       |
       v
   Shop Pool


admin.example.com
       |
       v
  Admin Pool
  

This makes Application Gateway useful when multiple web applications need to share an entry point while being routed to different backend pools.

TLS Termination

Application Gateway can terminate TLS connections at the gateway before forwarding traffic to backend servers according to the configured architecture.


Client
  |
 HTTPS
  |
  v
Application Gateway
  |
 TLS Termination
  |
  v
Backend
  

This can simplify certificate management and reduce the amount of TLS processing that individual backend servers need to perform.

End-to-end TLS can also be designed when encryption is required between the gateway and backend servers.

Web Application Firewall

Application Gateway can be deployed with Web Application Firewall capabilities to provide protection against common web application threats.

This is particularly relevant for internet-facing HTTP and HTTPS applications.


Internet
   |
   v
Application Gateway
   |
   +---- WAF Inspection
   |
   v
Backend Application
  

A WAF should be considered a security layer rather than a replacement for secure application development.

Health Probes

Both services use health probing concepts to determine whether backend resources are available to receive traffic, but Application Gateway's web-oriented capabilities allow HTTP-level health checks.

Load Balancer Example


TCP Probe
   |
   v
Backend Port 443
   |
   v
Healthy / Unhealthy
  

Application Gateway Example


HTTP/HTTPS Probe
       |
       v
GET /health
       |
       v
Expected Response
       |
       v
Healthy / Unhealthy
  

Application-aware health checks can be useful when simply establishing a TCP connection does not prove that the web application is functioning correctly.

When Should You Use Azure Load Balancer?

Azure Load Balancer is appropriate when the requirement is primarily network-level traffic distribution.

Common scenarios include:

  • TCP-based applications.
  • UDP-based workloads.
  • High-throughput network services.
  • Distributing traffic across virtual machines.
  • Internal application traffic.
  • Virtual Machine Scale Sets.

When Should You Use Application Gateway?

Application Gateway is generally suited to web applications where HTTP-level routing and application delivery features are required.

Common scenarios include:

  • HTTP and HTTPS applications.
  • URL-based routing.
  • Host-based routing.
  • TLS termination.
  • Web Application Firewall integration.
  • Cookie-based session affinity.
  • Multiple web applications behind one gateway.

Azure Load Balancer vs Application Gateway: Technical Comparison

Capability Azure Load Balancer Application Gateway
OSI Layer Layer 4 Layer 7
TCP Yes Not its primary use
UDP Yes No
HTTP Routing No Yes
URL Path Routing No Yes
Host-Based Routing No Yes
TLS Termination No Yes
WAF No Yes
Cookie-Based Affinity No Yes
Application-Aware Routing No Yes
Internal Load Balancing Yes Yes, depending on configuration
Primary Use Case Network traffic distribution Web application delivery

Can You Use Both Together?

Yes. In larger Azure architectures, different load-balancing services can be used at different layers because they solve different problems.


                    Internet
                       |
                       v
              Application Gateway
                       |
                 HTTP / HTTPS
                       |
                       v
                Azure Load Balancer
                       |
             +---------+---------+
             |         |         |
             v         v         v
           VM-01     VM-02     VM-03
  

The exact architecture depends on the application's networking, security and availability requirements. There is no requirement that an architecture use only one load-balancing service.

Example: Simple Web Application

Imagine a web application running on three backend VMs.


User
 |
 v
Application Gateway
 |
 +---- Web VM 1
 +---- Web VM 2
 +---- Web VM 3
  

If the application needs HTTP routing, TLS termination or WAF capabilities, Application Gateway can provide those application-delivery functions.

Example: TCP Application

Consider a custom TCP application that does not use HTTP.


Client
  |
  | TCP
  v
Azure Load Balancer
  |
  +---- Server 1
  +---- Server 2
  +---- Server 3
  

A Layer 4 load-balancing service is appropriate for this type of traffic because the application does not require HTTP-aware routing.

Performance Considerations

Load-balancing architecture should be designed around the actual workload rather than assuming that one service is universally faster.

Layer 4 load balancing operates without parsing HTTP application content, while Application Gateway provides additional application-level processing and routing capabilities.

When evaluating performance, measure:

  • Requests per second.
  • Connections per second.
  • Latency.
  • Backend response time.
  • TLS processing requirements.
  • Payload size.
  • Application behavior during peak traffic.

Security Considerations

Security requirements can strongly influence which service is appropriate.

Requirement Relevant Service
TCP/UDP distribution Load Balancer
HTTP routing Application Gateway
URL routing Application Gateway
Host routing Application Gateway
TLS termination Application Gateway
WAF Application Gateway
Network-level load balancing Load Balancer

Common Configuration Mistakes

1. Choosing Based Only on the Word "Load Balancer"

Both products distribute traffic, but they operate at different layers. The application protocol and routing requirements should drive the decision.

2. Expecting URL Routing From Load Balancer

Azure Load Balancer is not an HTTP reverse proxy designed for URL-based application routing.

3. Using Application Gateway for Non-HTTP Traffic

Application Gateway is designed around web traffic. Non-HTTP workloads should be evaluated against services designed for their networking requirements.

4. Misconfiguring Health Probes

A backend may appear healthy at the network level while the application itself is not functioning correctly. Select probe behavior that reflects the actual availability requirement.

5. Ignoring DNS

Application Gateway architectures frequently depend on correct DNS configuration, especially when host-based routing and private networking are involved.

6. Forgetting Backend Connectivity

A frontend load balancer or gateway being reachable does not guarantee that it can successfully connect to the backend.

Always verify:

  • NSG rules.
  • Routing.
  • Backend ports.
  • Health probes.
  • DNS resolution.
  • Application listener configuration.

Troubleshooting Azure Load Balancer

When a Load Balancer backend is not receiving traffic, check the following:

  1. Is the backend instance running?
  2. Is the expected port listening?
  3. Is the health probe succeeding?
  4. Are NSG rules allowing the required traffic?
  5. Are routing rules correct?
  6. Is the load-balancing rule configured correctly?

Troubleshooting Application Gateway

For Application Gateway problems, investigate both network and HTTP-level behavior.

  1. Check backend health.
  2. Check listeners.
  3. Check routing rules.
  4. Check backend HTTP settings.
  5. Check certificates for HTTPS.
  6. Check DNS resolution.
  7. Check NSG and routing configuration.
  8. Review diagnostic logs.

Which One Should You Choose?

The decision should be based on the technical requirements of the workload.


Is the workload HTTP/HTTPS?
          |
      +---+---+
      |       |
     No      Yes
      |       |
      v       v
Load       Do you need
Balancer   Layer 7 features?
            |
        +---+---+
        |       |
       No      Yes
        |       |
        v       v
Evaluate   Application
Load       Gateway
Balancer
  

Choose Azure Load Balancer when the primary requirement is Layer 4 traffic distribution, including TCP or UDP workloads.

Choose Application Gateway when the workload requires HTTP/HTTPS-aware routing, TLS termination, URL-based routing, host-based routing or WAF capabilities.

Quick Decision Table

Requirement Recommended Service
TCP application Azure Load Balancer
UDP application Azure Load Balancer
Basic VM load distribution Azure Load Balancer
HTTP/HTTPS web application Application Gateway
URL path routing Application Gateway
Host-based routing Application Gateway
TLS termination Application Gateway
Web Application Firewall Application Gateway
Application-aware health checks Application Gateway

Final Thoughts

Azure Load Balancer and Application Gateway are not simply two versions of the same product. They solve different networking problems.

Azure Load Balancer operates primarily at Layer 4 and is designed for high-scale network traffic distribution, including TCP and UDP workloads.

Application Gateway operates at Layer 7 and provides application-aware capabilities for HTTP and HTTPS workloads, including URL routing, host-based routing, TLS termination and WAF integration.

Understanding the difference between Layer 4 and Layer 7 is the key to selecting the appropriate architecture. In more complex environments, both services can also be used together as part of a multi-layer traffic-management design.

Official Microsoft Azure Resources

← All resources Get technical support →