Course contentsShow
← Cloud and Infrastructure
Lesson 239 of 2,9895. Load Balancing and Traffic ManagementFree lesson

Health Checks and Target Monitoring

Understand how load balancers probe backend targets to detect failures and route only to healthy instances.

Health Checks and Target Monitoring

What You'll Learn

You'll understand how load balancers automatically detect unhealthy backend servers and stop sending traffic to them.

Why Health Checks Matter

A load balancer's job isn't just distributing traffic—it's distributing traffic to servers that actually work. Health checks are the mechanism load balancers use to continuously verify that each backend target (server or instance) is responsive and ready to handle requests.

Think of it like a restaurant host who doesn't just assign tables—they first check which servers are actually on duty and ready before seating guests at their tables.

How Health Checks Work

The load balancer periodically sends a probe request to each target. This might be:

  • A simple TCP connection attempt (Layer 4 check)
  • An HTTP request to a specific path like /health or /ping (Layer 7 check)

The target must respond successfully within a timeout period. If it responds correctly, it's marked healthy. If it fails repeatedly, it's marked unhealthy and removed from the rotation.

Key Configuration Parameters

  • Interval: How often to send the probe (e.g., every 30 seconds)
  • Timeout: How long to wait for a response
  • Healthy threshold: Consecutive successes needed to mark target healthy
  • Unhealthy threshold: Consecutive failures needed to mark target unhealthy

This prevents flapping—rapidly switching a target in and out of service due to transient issues.

The Benefit

When a server crashes or becomes unresponsive, the load balancer automatically stops routing new requests to it. Users never hit the broken server. Once it recovers and passes health checks again, traffic resumes automatically.

Key Takeaway: Health checks are continuous probes that let load balancers detect failures and route traffic only to healthy targets, providing automatic fault tolerance without manual intervention.