[Editor – This post has been updated to reflect the features supported by NGINX Plus and Azure load balancing services as of June 2021. It also refers to the NGINX Plus API, which replaces and deprecates the separate dynamic configuration module mentioned in the original version of the post.]
Customers using Microsoft Azure have three options for load balancing: NGINX Plus, the Azure load balancing services, or NGINX Plus in conjunction with the Azure load balancing services. This post aims to give you enough information to make a decision and also shows you how using NGINX Plus with Azure Load Balancer can give you a highly available HTTP load balancer with rich Layer 7 functionality.
Microsoft Azure gives its users two choices of a load balancer: Azure Load Balancer for basic TCP/UDP load balancing (at Layer 4, the network layer) and Azure Application Gateway for HTTP/HTTPS load balancing (at Layer 7, the application layer). While these solutions work for simple use cases, they do not provide many features that come standard with NGINX Plus.
Here is a general comparison between NGINX Plus and the Azure load‑balancing offerings:
Feature | NGINX Plus | Azure Load Balancer | Azure Application Gateway | NGINX Plus & Azure Load Balancer |
---|---|---|---|---|
HTTP and HTTPS load balancing | ✅ | ❌ | ✅ | ✅ |
HTTP/2 load balancing | ✅ | ❌ | ✅ | ✅ |
WebSocket load balancing | ✅ | ❌ | ✅ | ✅ |
TCP/UDP load balancing | ✅ | ✅ | ❌ | ✅ |
Load balancing methods | Advanced | Simple | Simple | Advanced |
Session persistence | Advanced | Simple | Simple | Advanced |
HTTP health checks | Advanced | Simple | Simple | Advanced |
TCP/UDP health checks | Advanced | Simple | ❌ | Advanced |
SSL/TLS termination | ✅ | ❌ | ✅ | ✅ |
Rate and connection limits | ✅ | ❌ | ❌ | ✅ |
URL rewriting and redirecting | ✅ | ❌ | ✅ | ✅ |
URL request mapping | ✅ | ❌ | ✅ | ✅ |
Active-active NGINX Plus cluster | ❌ | ❌ | ❌ | ✅ |
Now let’s now explore some of the differences between NGINX Plus and the Azure load balancing services, their unique features, and how NGINX Plus and Azure load balancers can work together.
NGINX Plus offers a choice of several load‑balancing methods in addition to the default Round Robin method:
Source
IP
Address
and Source
Port
header fields, or the URI.two
parameter is included, NGINX Plus selects two servers at random and then chooses between them using either the Least Connections algorithm (the default) or Least Time, as configured.All of the methods can be extended by assigning different weight values to each backend server. For details on the methods, see the NGINX Plus Admin Guide.
Azure Load Balancer offers one load balancing method, Hash, which by default uses a key based on the Source
IP
Address
, Source
Port
, Destination
IP
Address
, Destination
Port
, and Protocol
header fields to choose a backend server.
Azure Application Gateway provides only a round‑robin method.
Session persistence, also known as sticky sessions or session affinity, is needed when an application requires that all requests from a specific client continue to be sent to the same backend server because client state is not shared across backend servers.
NGINX Plus supports three advanced session‑persistence methods:
NGINX Plus also offers two basic session‑persistence methods, implemented as two of the load‑balancing methods described above:
Source
IP
Address
and Source
Port
, or the URI.Azure Load Balancer supports the equivalent of the NGINX Plus Hash method, although the key is limited to certain combinations of the Source
IP
Address
, Source
Port
, Destination
IP
Address
, Destination
Port
, and Protocol
header fields.
Azure Application Gateway supports the equivalent of the NGINX Plus Sticky Cookie method with the following limitations: you cannot configure the name of the cookie, its expiration date, the domain, the path, or the HttpOnly
or Secure
cookie attributes.
Note: When you use Azure Load Balancer, the NGINX Plus IP Hash method, or the NGINX Plus Hash method with the Source
IP
Address
included in the key, session persistence works correctly only if the client’s IP address remains the same throughout the session. This is not always the case, as when a mobile client switches from a WiFi network to a cellular one, for example. To make sure requests continue hitting the same backend server, it is better to use one of the advanced session‑persistence methods listed above.
Azure Load Balancer and Azure Application Gateway support basic application health checks. You can specify the URL that the load balancer requests, and it considers the backend server healthy if it receives the expected HTTP 200
return code. You can specify the health check frequency and the timeout period before the server is considered unhealthy. With Azure Application Gateway, you can also customize the expected response code and match against the contents of the response body.
NGINX Plus extends this functionality with advanced health checks. In addition to specifying the URL to use, with NGINX Plus you can insert headers into the request and look for different response codes, and examine both the headers and body of the response.
A useful related feature in NGINX Plus is slow start. NGINX Plus slowly ramps up the load to a new or recently recovered server so that it doesn’t become overwhelmed by connections.This is useful when your backend servers require some warm‑up time and will fail if they are given their full share of traffic as soon as they show as healthy.
NGINX Plus also supports health checks to TCP and UDP servers, which allow you to specify a string to send and a string to look for in the response.
Azure Load Balancer supports TCP health checks, but does not offer this level of monitoring.
NGINX Plus supports SSL/TLS termination, as does Azure Application Gateway. Azure Load Balancer does not.
With NGINX Plus, you can configure multiple limits to control the traffic to and from your NGINX Plus instance. These include limiting inbound connections, the connections to backend nodes, the rate of inbound requests, and the rate of data transmission from NGINX Plus to clients.
Azure Application Gateway and Azure Load Balancer do not support rate or connection limits. However, you can use other Azure services to configure and enable rate limiting.
NGINX Plus, Azure Application Gateway, and Azure Load Balancer all support the following:
When used together with Azure Load Balancer and Azure Traffic Manager, NGINX Plus becomes a highly available load balancer solution with rich Layer 7 functionality.
By using Azure Load Balancer to load balance across NGINX Plus instances in an Availability Set, you create a highly available load balancer within a region.
You can set up autoscaling of NGINX Plus instances based on average CPU usage. This is possible by creating Availability Sets in the Azure Cloud Service that hosts your NGINX Plus instances. You need to take care of synchronization of NGINX Plus config files.
You can also set up autoscaling of your backend instances based on average CPU usage. This is possible by creating Availability Sets in the Azure Cloud Service that hosts your backend instances. You need to take care of adding or removing backend instances from the NGINX Plus configuration, which is possible with the NGINX Plus API.
To automate updates to the NGINX Plus configuration (either in combination with Availability Sets or when using NGINX Plus on its own), you can integrate a service discovery system with NGINX Plus, either via the NGINX Plus API or via DNS, if the system has a DNS interface. Check out our blog posts on using NGINX Plus with popular service discovery systems:
For a globally distributed environment you can use Azure Traffic Manager to distribute traffic from clients across many regions.
Azure Load Balancer and Application Gateway are managed by Azure Cloud and both provide a highly available load‑balancing solution.
A feature of Azure Load Balancer that is not available in NGINX Plus is source NAT, in which traffic outbound from backend instances has the same source IP address as the load balancer.
Azure Load Balancer provides automatic reconfiguration when using Azure Cloud’s autoscaling feature.
If your load balancing requirements are simple, the Azure load balancing offerings can provide a good solution. When the requirements get more complex, NGINX Plus is a good choice. You can use NGINX Plus either alone or in conjunction with Azure Load Balancer for high availability of NGINX Plus instances.
To try NGINX Plus on Microsoft Azure, start your free 30-day trial today or contact us to discuss your use cases.
"This blog post may reference products that are no longer available and/or no longer supported. For the most current information about available F5 NGINX products and solutions, explore our NGINX product family. NGINX is now part of F5. All previous NGINX.com links will redirect to similar NGINX content on F5.com."