0
0
Azurecloud~10 mins

Load balancing rules in Azure - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Load balancing rules
Client sends request
Load Balancer receives request
Check load balancing rule
Select backend pool based on rule
Forward request to selected backend
Backend processes request and responds
Response sent back to client
The load balancer receives client requests, applies the load balancing rule to select a backend server, forwards the request, and returns the response.
Execution Sample
Azure
az network lb rule create \
  --resource-group MyResourceGroup \
  --lb-name MyLoadBalancer \
  --name MyLoadBalancingRule \
  --protocol Tcp \
  --frontend-port 80 \
  --backend-port 80 \
  --frontend-ip-name MyFrontEnd \
  --backend-pool-name MyBackEndPool
Creates a load balancing rule that forwards TCP traffic on port 80 from the frontend IP to backend pool servers on port 80.
Process Table
StepActionInputRule EvaluationBackend SelectedOutput
1Client sends requestRequest to LB IP:80N/AN/ARequest received by Load Balancer
2Load Balancer checks ruleRequest on port 80 TCPMatches rule for port 80 TCPBackend Pool MyBackEndPoolRule matched
3Select backend serverBackend Pool Members: VM1, VM2Round-robin selectionVM1Request forwarded to VM1
4Backend processes requestRequest at VM1 port 80N/AVM1Response generated
5Response sent backResponse from VM1N/AN/AResponse returned to client
6Next requestRequest to LB IP:80Matches rule for port 80 TCPVM2Request forwarded to VM2
7Backend processes requestRequest at VM2 port 80N/AVM2Response generated
8Response sent backResponse from VM2N/AN/AResponse returned to client
9Request on different portRequest to LB IP:443No matching ruleN/ARequest dropped or rejected
💡 Execution stops when no matching load balancing rule is found or request is completed.
Status Tracker
VariableStartAfter Step 3After Step 6Final
Selected BackendNoneVM1VM2VM2
Request Port808080443
Rule MatchedFalseTrueTrueFalse
Key Moments - 3 Insights
Why does the load balancer forward the first request to VM1 and the second to VM2?
Because the load balancing rule uses round-robin distribution, it cycles through backend servers to balance load evenly, as shown in execution_table rows 3 and 6.
What happens if a request comes on a port not defined in any load balancing rule?
The load balancer does not forward the request to any backend and drops or rejects it, as seen in execution_table row 9.
Does the load balancer change the port number when forwarding the request to the backend?
No, the load balancer forwards the request to the backend on the backend port defined in the rule, which can be the same or different from the frontend port, as shown in the execution sample command.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, which backend server handles the second client request?
AVM3
BVM1
CVM2
DNo backend selected
💡 Hint
Check the 'Backend Selected' column at Step 6 in the execution_table.
At which step does the load balancer determine that no matching rule exists for the request?
AStep 9
BStep 2
CStep 5
DStep 1
💡 Hint
Look for the step where 'Rule Evaluation' shows 'No matching rule' in the execution_table.
If the frontend port in the rule changed from 80 to 443, what would happen to requests on port 80?
AThey would be forwarded to backend servers
BThey would be dropped or rejected
CThey would be forwarded to port 443 on backend
DThey would be redirected to another load balancer
💡 Hint
Refer to the 'Rule Evaluation' and 'Output' columns in execution_table row 9.
Concept Snapshot
Load balancing rules define how incoming traffic is distributed to backend servers.
They specify frontend IP, protocol, frontend port, backend port, and backend pool.
The load balancer matches requests to rules and forwards them accordingly.
Common distribution methods include round-robin.
Requests not matching any rule are dropped or rejected.
Full Transcript
Load balancing rules in Azure define how the load balancer distributes incoming client requests to backend servers. When a client sends a request, the load balancer checks its rules to find a match based on protocol and port. If a rule matches, it selects a backend server from the backend pool, often using round-robin, and forwards the request. The backend processes the request and sends a response back through the load balancer to the client. Requests that do not match any rule are dropped or rejected. This process ensures even distribution of traffic and high availability.