Load Balancing and Traffic Management
Choose the right Azure traffic service based on layer, protocol, and scope: Azure Load Balancer, Application Gateway, Front Door, and Traffic Manager.
What Is It? (Simple Explanation)
Load balancing spreads traffic across healthy backends so one overloaded server does not bring down the application.
Why Do We Need It?
- High availability and fault tolerance.
- Performance under burst traffic.
- Controlled traffic steering across regions and applications.
How It Works (Technical)
| Service | Layer | Scope | Best For |
|---|---|---|---|
| Azure Load Balancer | L4 TCP/UDP | Regional | VM scale set traffic distribution |
| Application Gateway | L7 HTTP/HTTPS | Regional | Path-based routing + WAF |
| Azure Front Door | L7 global edge | Global | Global web acceleration and failover |
| Traffic Manager | DNS-based | Global | Endpoint selection by DNS policy |
Real-world Analogy
Load Balancer is a receptionist assigning visitors to available staff. Traffic Manager is a city-level signboard sending people to different branches.
Visual Representation
Hands-on Commands
# Create public load balancer az network lb create -g rg-lb -n lb-web --sku Standard --public-ip-address lb-pip --frontend-ip-name fe-web --backend-pool-name be-web # Create health probe az network lb probe create -g rg-lb --lb-name lb-web -n probe-http --protocol Http --port 80 --path / # Create load balancing rule az network lb rule create -g rg-lb --lb-name lb-web -n rule-http \ --protocol Tcp --frontend-port 80 --backend-port 80 \ --frontend-ip-name fe-web --backend-pool-name be-web --probe-name probe-http
Real-world Use Case
An e-commerce platform uses Front Door for global region failover, Application Gateway with WAF for web-layer protection, and internal load balancer for app-tier VM pools.
Debugging Scenario
Issue: Load balancer is up, but backend receives no traffic.
- Check backend pool member health.
- Validate probe path and status code responses.
- Confirm NSG allows probe and client traffic.
- Ensure backend app listens on expected port and interface.
Interview Questions
Beginner
Load Balancer works at Layer 4; App Gateway works at Layer 7 and supports HTTP-aware routing and WAF.
Intermediate
Front Door proxies HTTP/HTTPS at edge with acceleration and failover. Traffic Manager is DNS-based endpoint selection, not a proxy.
Scenario-based
Use Front Door with multiple regional origins, health probes, and weighted or priority routing combined with regional app gateways and backend pools.
Summary
Select traffic services based on layer and scope: L4 regional balancing, L7 application routing, or global edge/dns routing. Correct selection is a key architecture decision.