Azure Load Balancer vs Azure Application Gateway - Part 2

2024年2月9日- By Hisham Nawzer

In this article, we will learn about the Azure Load Balancer and Azure Application Gateway individually and when to use which, as these two resources have features in common. See Part 1 for the Azure Load Balancer. 

1. Overview of Azure Application Gateway

We learned that an Application Gateway is also a type of load balancer in Azure. However, in contrast to Azure Load Balancer, Azure Application Gateway operates at application layer (Layer 7 in OSI model). 

Azure Application Gateway also consists of the common components described in Azure Load Balancer. Nonetheless, some components are unique to the Azure Application Gateway. 


Listeners serve as logical entities responsible for examining incoming connection requests. When a listener receives a request, it assesses whether the request is acceptable by comparing the associated protocol, port, hostname, and IP address with its configured settings.

Prior to utilizing an Azure Application Gateway, it is essential to establish at least one listener. Multiple listeners can be connected to an Azure Application Gateway, and they can be designated for the same protocol.

Once a listener identifies incoming requests from clients, the Azure Application Gateway directs these requests to members within the backend pool as defined by the associated rules.

1-2. Routing rules

Routing rules play a crucial role in Azure Application Gateway’s functionality. These rules establish a connection between the listener, the backend server pool, and the backend HTTP settings.

When a listener accepts a request, the request routing rule takes charge of either forwarding the request to the backend or redirecting it elsewhere. If directed to the backend, the rule specifies which backend server pool should receive the request. Additionally, the request routing rule governs whether the headers in the request need to be rewritten. Importantly, one listener can be associated with one rule.
In general, there are two types of request routing rules.

  • Basic Rule: All requests on the linked listener (e.g.,*) are directed to the corresponding backend pool using the associated HTTP setting.
  • Path-based Rule: This rule type enables the routing of requests on the linked listener to a specific backend pool based on the URL in the request. If the URL path in a request matches the path pattern specified in a path-based rule, that rule becomes applicable. The path pattern only pertains to the URL path, excluding its query parameters. In cases where the URL path doesn’t align with any path-based rules, the request is routed to the default backend pool and HTTP settings [1]. 

The following architectural image can be used to determine how an Azure Application Gateway can be used to implement layer 7 load balancing.

Figure 1- Azure Application Gateway and how it works [2]

2. A comparison on Azure Load Balancer vs Azure Application Gateway and when to use what

Azure Load Balancer and Azure Application Gateway are both services in Microsoft Azure that provide traffic distribution, but they serve different purposes and have distinct features. Here are the key differences between Azure Load Balancer and Azure Application Gateway:

2-1. Layer of Operation
  • Azure Load Balancer (ALB): Operates at the transport layer (Layer 4) of the OSI model. It distributes incoming network traffic across multiple servers based on factors like round-robin or least connections.
  • Azure Application Gateway (AG): Operates at the application layer (Layer 7) of the OSI model. It can make routing decisions based on content, enabling features like URL-based routing and SSL termination. 
2-2. Use Cases
  • Azure Load Balancer (ALB):

    Primarily used for distributing network traffic among multiple servers to ensure high availability and reliability. Suitable for applications that rely on protocols like TCP or UDP. 

  • Azure Application Gateway (AG):

    Designed for applications that require application layer processing, such as SSL termination, URL-based routing, and web application firewall (WAF) capabilities. Ideal for web applications. 

2-3. Protocols
  • Azure Load Balancer (ALB):

    Supports protocols at the transport layer, such as TCP and UDP. 

  • Azure Application Gateway (AG):

    Supports HTTP, HTTPS, and WebSocket protocols, allowing it to make routing decisions based on the content of the HTTP requests.

2-4. Routing and Load Balancing
  • Azure Load Balancer (ALB):

    Distributes traffic based on network information (IP address and port). 

  • Azure Application Gateway (AG):

    Performs more advanced routing based on content, enabling URL-based routing, and allowing for more sophisticated load-balancing scenarios. 

2-5. Web Application Firewall (WAF)
  • Azure Load Balancer (ALB):

    Does not have built-in WAF capabilities.

  • Azure Application Gateway (AG):

    Includes a web application firewall (WAF) to help protect web applications from common vulnerabilities. 

3. Conclusion

Load balancers play an important role in distributing traffic to web servers to make sure the users can access the systems smoothly without interruptions. I hope this article gave an overall idea on Load balancers especially on Azure Load Balancer and Azure Application Gateway. 

About Rackspace

Discover the power of Rackspace Technology, brought to you by the Global Solutions Division of Iret Inc. in Japan. Elevate your cloud experience with our tailored end-to-end AWS and Microsoft Azure solutions. From expert consulting and seamless integration to cutting-edge development and daily operations, we are your dedicated partner in unleashing the full potential of the cloud. Are you ready to get started? Click the contact button below to get in touch with one of our experts.