Load balancer
Load Balancer distributes traffic within the same region to make service/resources more available and resilient and helps minimize downtime.
The load balancer can distribute traffic between multiple VMs to achieve high capacity, but load balancer can improve resilience because load balancer can automatically route traffic away when a (single) VM fails.
Distribution modes
Load balancers use by default hash-based distribution algorithm:
Five-tuple hash is used by default to map traffic equally among available servers. Hash ensures in distribution mode that requests from source to destination. When creating the load balancer, the distribution mode must be specified using PowerShell, Azure CLI, or through Azure Portal (Session persistence options).
The hash is composed of:
1) Source IP
2) Source Port
3) Destination IP
4) Destination Port
5) Protocol Type (Layer 4)
Source IP affinity (aka session affinity or client IP affinity)
This distribution mode used a two-tuple hash (from the source IP address and destination IP address) or three-tuple hash (from the source IP address and destination IP address, and protocol type). This two-tuple hash ensures that requests from a specific client are always sent to the same virtual machine behind the load balancer. This can be useful to maintain a user’s session.
Remote Desktop Gateway connection through Load Balancer is incompatible with the default five-tuple hash, instead of the distribution mode Source IP affinity must be used.
Availability set
Protection from hardware failures within datacenters. VM machines are put in separate fault domains across server racks, multiple physical servers, compute racks, storage units, and network switches.
Availability zone
Protection from entire data center failure, by putting them into a separate datacenter (Availability Zone) within the Azure Region. Note that not all regions support availability zones.
Types of Load Balancers
Internal / External Load Balancers
External Load Balancer distributes traffic from the internet across multiple virtual machines.
Internal Load Balancer distributes the load from internal Azure resources across Azure resources. No traffic from the internet is allowed into an internal load balancer.
External Load Balancers are also called Public Load Balancers, map the public IP and port number of incoming traffic to the private IP address and port number of the server in the backend pool.
Traffic Manager
Traffic Manager uses the DNS server that’s closest to the user to direct user traffic to a globally distributed endpoint, endpoint closer to the user, to reduce latency. It is DNS based load balancing the traffic to regions across the world to improve the performance. Traffic Manager doesn’t see the traffic that is passed between clients and the Azure web server, it just provides the IP address where the client needs to send its traffic to. There exist multiple types of endpoints supported by Traffic Manager:
- Azure Endpoints: Azure resource with a public IP address
- External Endpoints: public IP address belonging to the machine on-premise or server at an external hosting provider.
Routing Methods
Traffic Manager supports 6 routing methods that determine for each DNS query it receives how traffic is routed to multiple endpoints.
- Weighted Routing: Each endpoint is assigned a weight (integer value) that determines the probability that the Traffic Manager will choose that endpoint
- Performance Routing: Uses internet latency table, which actively tracks network latencies to the endpoints, and Traffic Manager selects the best returning endpoint.
- Geographic Routing: users are directed to specific endpoints based on where their DNS query originates
- Multivalue Routing: Traffic Manager returns multiple healthy endpoints so that the caller can attempt multiple devices without sending a new request.
- Subnet Routing: maps user IP address ranges to specific endpoints. The endpoint returned will depend on the user source IP address range.
- Priority Routing: List of endpoints are prioritized, such that by default the Traffic Manager returns the endpoint with the highest priority, and if that is not available, the endpoint with the second-highest priority.
Load Balancer vs Traffic Manager
Difference between Load Balancer and Traffic Manager: Traffic Manager works on the DNS level and directs the user to the nearest responsive endpoint, while Load Balancer directs to another responsive endpoint.
(Load Balancer is restricted to a region (with availability zones), while Traffic Manager can deal with distribution of traffic across regions.)
Application Gateway
Application Gateway is a load balancer for web applications and applies sophisticated URL based routing rules. Notice that this load balancer works on OSI layer 7, while other Azure load balancers function at OSI layer 4.
Application Layer Routing: Application Gateway routes traffic to a pool of backend web servers based on the URL of a request. Notice that routing decisions are made on OSI layer 7.
There are two methods of routing traffic:
- Path-based Routing: depending on the different paths in the URL, the request is sent to a different pool of web servers in the backend
- Multiple site Hosting: configuring multiple web applications on the same application gateway instance
Official Microsoft Azure Learning Path
https://docs.microsoft.com/en-us/learn/paths/azure-fundamentals/