Bird
Raised Fist0
Azurecloud~10 mins

Azure Load Balancer (Layer 4) - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Process Flow - Azure Load Balancer (Layer 4)
Client sends request
↓
Azure Load Balancer receives request
↓
Check load balancing rules
↓
Select backend VM based on health and distribution
↓
Forward request to selected VM
↓
VM processes request and sends response
↓
Load Balancer forwards response back to client
The Azure Load Balancer receives client requests, selects a healthy backend VM using Layer 4 rules, forwards the request, and returns the response.
Execution Sample
Azure
1. Client sends TCP request to Load Balancer IP
2. Load Balancer checks rules and health probes
3. Load Balancer forwards request to healthy VM
4. VM processes and responds
5. Load Balancer sends response back to client
This sequence shows how Azure Load Balancer routes a TCP request to a backend VM and returns the response.
Process Table
StepActionLoad Balancer DecisionBackend VM SelectedResponse Sent
1Client sends TCP request to Load Balancer IPReceived requestNone yetNo
2Load Balancer checks load balancing rulesRule matched for TCP port 80None yetNo
3Load Balancer checks health probesBackend VM1 healthy, VM2 unhealthyVM1 selectedNo
4Load Balancer forwards request to VM1Request forwardedVM1No
5VM1 processes requestProcessingVM1No
6VM1 sends response to Load BalancerResponse receivedVM1No
7Load Balancer forwards response to clientResponse forwardedVM1Yes
8End of request cycleRequest completeVM1Yes
💡 Request cycle ends after response is forwarded back to client.
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 7Final
Request StateNot receivedReceivedReceivedForwarded to VM1Response forwardedComplete
Selected Backend VMNoneNoneVM1VM1VM1VM1
Response StateNoneNoneNoneNoneReceived from VM1Sent to client
Key Moments - 3 Insights
Why does the Load Balancer select VM1 and not VM2?
Because the health probe check at step 3 shows VM1 is healthy and VM2 is unhealthy, so only VM1 is selected as backend.
Does the Load Balancer inspect the content of the request?
No, Azure Load Balancer works at Layer 4, so it only looks at IP and port, not the request content, as shown in step 2.
When is the client response sent back?
At step 7, after the backend VM processes the request and sends the response to the Load Balancer, which then forwards it to the client.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, which backend VM is selected at step 3?
AVM1
BVM2
CNone
DBoth VM1 and VM2
💡 Hint
Check the 'Backend VM Selected' column at step 3 in the execution table.
At which step does the Load Balancer forward the response back to the client?
AStep 4
BStep 6
CStep 7
DStep 8
💡 Hint
Look at the 'Response Sent' column in the execution table to find when it changes to 'Yes'.
If VM1 became unhealthy, what would change in the execution table at step 3?
ALoad Balancer would select VM2 if healthy
BLoad Balancer would select VM1 anyway
CLoad Balancer would not forward the request
DLoad Balancer would forward to both VMs
💡 Hint
Refer to the 'Load Balancer Decision' and 'Backend VM Selected' columns at step 3.
Concept Snapshot
Azure Load Balancer (Layer 4):
- Operates at transport layer (TCP/UDP)
- Routes traffic based on IP and port
- Uses health probes to select healthy backend VMs
- Forwards client requests to backend VMs
- Returns VM responses back to clients
- Does not inspect request content
Full Transcript
Azure Load Balancer at Layer 4 receives client TCP requests and uses load balancing rules and health probes to select a healthy backend VM. It forwards the request to the selected VM, which processes it and sends a response back. The Load Balancer then forwards this response to the client, completing the request cycle. It works by routing based on IP and port without inspecting the request content.

Practice

(1/5)
1. What is the primary function of the Azure Load Balancer (Layer 4)?
easy
A. Encrypt data at rest in Azure storage
B. Inspect and modify HTTP headers for incoming requests
C. Store and manage user session data
D. Distribute incoming TCP/UDP traffic evenly across multiple servers

Solution

  1. Step 1: Understand Layer 4 Load Balancing

    Azure Load Balancer works at the transport layer (Layer 4) to distribute TCP/UDP traffic.
  2. Step 2: Identify its main role

    It balances traffic across multiple servers to improve availability and scalability without inspecting message content.
  3. Final Answer:

    Distribute incoming TCP/UDP traffic evenly across multiple servers -> Option D
  4. Quick Check:

    Layer 4 Load Balancer = TCP/UDP traffic distribution [OK]
Hint: Layer 4 means TCP/UDP traffic balancing only [OK]
Common Mistakes:
  • Confusing Layer 4 with Layer 7 load balancer features
  • Thinking it inspects HTTP headers
  • Assuming it manages session data
2. Which of the following is the correct way to configure a backend pool in Azure Load Balancer (Layer 4)?
easy
A. Configure SSL certificates in the backend pool
B. Assign virtual machines or VM scale sets to the backend pool
C. Add HTTP routes to the backend pool
D. Set up DNS names in the backend pool

Solution

  1. Step 1: Understand backend pool composition

    Backend pools in Azure Load Balancer contain virtual machines or VM scale sets to receive traffic.
  2. Step 2: Eliminate incorrect options

    HTTP routes, SSL certificates, and DNS names are not configured in backend pools for Layer 4 load balancer.
  3. Final Answer:

    Assign virtual machines or VM scale sets to the backend pool -> Option B
  4. Quick Check:

    Backend pool = VMs or VM scale sets [OK]
Hint: Backend pool holds VMs or VM scale sets only [OK]
Common Mistakes:
  • Trying to add HTTP routes to backend pool
  • Confusing SSL setup with load balancer config
  • Adding DNS names instead of VMs
3. Given an Azure Load Balancer configured with 3 healthy backend VMs, what happens when one VM becomes unhealthy?
medium
A. Traffic is routed only to the 2 healthy VMs
B. Traffic is evenly distributed to all 3 VMs regardless
C. Load balancer stops routing traffic until all VMs are healthy
D. Traffic is routed only to the unhealthy VM

Solution

  1. Step 1: Understand health probe role

    Azure Load Balancer uses health probes to detect unhealthy VMs and stops sending traffic to them.
  2. Step 2: Apply health probe behavior

    When one VM is unhealthy, traffic is routed only to the remaining healthy VMs to maintain availability.
  3. Final Answer:

    Traffic is routed only to the 2 healthy VMs -> Option A
  4. Quick Check:

    Unhealthy VM excluded from traffic [OK]
Hint: Unhealthy VMs do not get traffic [OK]
Common Mistakes:
  • Assuming traffic still goes to unhealthy VMs
  • Thinking load balancer stops all traffic
  • Believing unhealthy VMs get all traffic
4. You configured an Azure Load Balancer but clients report intermittent connection failures. What is a likely cause?
medium
A. Backend VMs have too much CPU capacity
B. Load balancer is inspecting HTTP headers incorrectly
C. Health probes are misconfigured, marking healthy VMs as unhealthy
D. DNS names are missing in the backend pool

Solution

  1. Step 1: Analyze symptoms

    Intermittent connection failures often relate to backend availability issues.
  2. Step 2: Identify misconfiguration impact

    If health probes are misconfigured, healthy VMs may be marked unhealthy, reducing available servers and causing failures.
  3. Final Answer:

    Health probes are misconfigured, marking healthy VMs as unhealthy -> Option C
  4. Quick Check:

    Misconfigured health probes cause connection failures [OK]
Hint: Check health probe settings first for connection issues [OK]
Common Mistakes:
  • Blaming backend VM CPU capacity without evidence
  • Thinking Layer 4 load balancer inspects HTTP headers
  • Assuming DNS names belong in backend pool
5. You want to design a highly available web service using Azure Load Balancer (Layer 4). Which combination ensures scalability and fault tolerance?
hard
A. Use a backend pool with multiple VM scale sets and configure health probes
B. Use a single VM with static IP and no health probes
C. Configure DNS round-robin without load balancer
D. Use Azure Load Balancer with only one backend VM and no health probes

Solution

  1. Step 1: Identify scalability needs

    Multiple VM scale sets allow automatic scaling of backend servers to handle load.
  2. Step 2: Ensure fault tolerance

    Health probes detect unhealthy instances and route traffic only to healthy ones, improving availability.
  3. Step 3: Evaluate other options

    Single VM or no health probes reduce fault tolerance; DNS round-robin lacks health checks and load balancing features.
  4. Final Answer:

    Use a backend pool with multiple VM scale sets and configure health probes -> Option A
  5. Quick Check:

    Scale sets + health probes = scalable, fault tolerant [OK]
Hint: Combine scale sets with health probes for best availability [OK]
Common Mistakes:
  • Using single VM reduces fault tolerance
  • Ignoring health probes causes traffic to unhealthy VMs
  • Relying on DNS round-robin lacks health checks