Microsoft Azure

Azure Load Balancer

Last updated: October 26, 2023

Azure Load Balancer is a Layer 4 (TCP, UDP) load balancer that enables you to distribute network traffic to applications running on Azure virtual machines. It provides high availability and application scalability.

Overview

Azure Load Balancer is a fully managed cloud service that provides high availability and network load balancing for applications. It distributes incoming traffic across a pool of backend resources, such as virtual machines.

Key Features

Diagram: Azure Load Balancer Architecture

Types of Load Balancers

Azure offers two types of load balancers:

Standard Load Balancer

The Standard Load Balancer provides advanced features and is recommended for most production workloads. It offers:

Basic Load Balancer

The Basic Load Balancer is suitable for development and testing or for less critical workloads. It has lower scale limits and lacks some advanced features.

How it Works

Azure Load Balancer uses a hash-based distribution algorithm to distribute traffic across available backend instances. It continuously monitors the health of backend instances using configured health probes. If an instance fails a health probe, it is automatically removed from the load-balancing pool.

Example Configuration

To set up Azure Load Balancer, you typically define:

  1. Frontend IP Configuration: The IP address(es) that clients connect to.
  2. Backend Pool: A collection of virtual machines that will receive traffic.
  3. Load Balancing Rules: Rules that map a frontend IP and port to a backend IP and port, including the protocol and health probe.
  4. Health Probes: Configurations to check the health of backend instances.

Here's a snippet of what a load balancing rule might look like (conceptual):


{
  "name": "myLoadBalancerRule",
  "frontendIPConfiguration": {
    "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/loadBalancers/myLoadBalancer/frontendIPConfigurations/frontend1"
  },
  "backendAddressPool": {
    "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/loadBalancers/myLoadBalancer/backendAddressPools/backendPool1"
  },
  "protocol": "Tcp",
  "frontendPort": 80,
  "backendPort": 80,
  "enableFloatingIP": "Disable",
  "idleTimeoutInMinutes": 4,
  "probe": {
    "id": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/loadBalancers/myLoadBalancer/probes/httpProbe"
  }
}
            

Use Cases

Azure Load Balancer is ideal for:

Tip: For HTTP/HTTPS traffic and advanced routing features like SSL offloading and URL-based routing, consider using Azure Application Gateway.

Next Steps

Explore the following resources to learn more: