Backend pools and health probes in Azure - Time & Space Complexity
Start learning this pattern below
Jump into concepts and practice - no test required
When managing backend pools and health probes in Azure, it's important to understand how the number of backend servers affects the time it takes to check their health.
We want to know how the time to perform health checks grows as we add more servers to the pool.
Analyze the time complexity of the following operation sequence.
// Define backend pool with multiple servers
var backendPool = new BackendPool();
// For each server, create a health probe
foreach (var server in backendPool.Servers) {
var probe = new HealthProbe(server.IpAddress, probePort, probePath);
probe.CheckHealth();
}
This sequence creates a health probe for each server in the backend pool and checks its health status.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Health probe check for each backend server.
- How many times: Once per server in the backend pool.
Each additional server adds one more health check operation, so the total checks grow directly with the number of servers.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 health probe checks |
| 100 | 100 health probe checks |
| 1000 | 1000 health probe checks |
Pattern observation: The number of health checks grows linearly as the number of backend servers increases.
Time Complexity: O(n)
This means the time to complete all health probes grows in direct proportion to the number of backend servers.
[X] Wrong: "Adding more servers won't affect health check time because probes run in parallel."
[OK] Correct: While probes can run concurrently, the total number of checks still increases with servers, so overall resource use and time scale linearly.
Understanding how backend health checks scale helps you design reliable and efficient cloud services, a key skill in real-world cloud architecture.
"What if we grouped servers and checked health only once per group? How would the time complexity change?"
Practice
Solution
Step 1: Understand backend pool role
A backend pool groups multiple servers to distribute incoming traffic among them.Step 2: Differentiate from health probes
Health probes check server status, but backend pools organize servers for load balancing.Final Answer:
To group servers that will share incoming user requests -> Option DQuick Check:
Backend pool = group servers for requests [OK]
- Confusing backend pools with health probes
- Thinking backend pools store data
- Mixing backend pools with network creation
Solution
Step 1: Identify valid protocols for health probes
Azure Load Balancer supports TCP and HTTP probes; FTP and UDP are invalid.Step 2: Check probe parameters
healthProbe: { protocol: 'TCP', port: 80, intervalInSeconds: 15, numberOfProbes: 2 } uses TCP on port 80 with reasonable intervals and probe counts, matching best practices.Final Answer:
healthProbe: { protocol: 'TCP', port: 80, intervalInSeconds: 15, numberOfProbes: 2 } -> Option AQuick Check:
Valid protocol and settings = healthProbe: { protocol: 'TCP', port: 80, intervalInSeconds: 15, numberOfProbes: 2 } [OK]
- Using unsupported protocols like FTP or UDP
- Setting too few probes causing false negatives
- Choosing invalid port numbers
protocol: 'HTTP', port: 8080, intervalInSeconds: 10, numberOfProbes: 3
If the backend server responds successfully on the first two probes but fails on the third, what will Azure Load Balancer do?
Solution
Step 1: Understand numberOfProbes meaning
numberOfProbes defines how many consecutive failed probes mark a server unhealthy.Step 2: Analyze probe results
Only one failure occurred, so the server is still healthy until 3 consecutive failures happen.Final Answer:
Mark the server as unhealthy after three consecutive failures -> Option BQuick Check:
3 failures needed to mark unhealthy = Mark the server as unhealthy after three consecutive failures [OK]
- Marking unhealthy after a single failure
- Ignoring the numberOfProbes setting
- Assuming any failure removes server immediately
Solution
Step 1: Check health probe configuration
If the probe uses the wrong port or protocol, it will fail to get a healthy response from the server.Step 2: Rule out other causes
Too many servers or missing public IP do not cause probe failures; overload affects performance but not probe success directly.Final Answer:
Health probe is configured with the wrong port or protocol -> Option CQuick Check:
Wrong probe config causes false unhealthy status [OK]
- Blaming backend pool size for probe failures
- Ignoring probe configuration details
- Assuming public IP affects probe health
Solution
Step 1: Use a single backend pool for load distribution
Grouping all servers in one backend pool balances traffic and improves availability.Step 2: Configure a valid health probe with appropriate settings
TCP probe on port 80 with short intervals and few probes quickly detects unhealthy servers.Step 3: Evaluate other options
Separate pools reduce load balancing benefits; no probes risk sending traffic to bad servers; unsupported protocols cause failures.Final Answer:
Create a backend pool with all three servers and a TCP health probe on port 80 with 5-second intervals and 2 probes -> Option AQuick Check:
All servers + valid probe = best reliability [OK]
- Splitting servers into multiple pools unnecessarily
- Skipping health probes
- Using unsupported protocols for probes
