Course contentsShow
← System Design
Lesson 103 of 1,9193. Load BalancingFree lesson

Marking Servers Unhealthy

Load balancers stop routing traffic to servers that fail consecutive health checks, removing them from the rotation automatically.

Marking Servers Unhealthy

What you'll learn: How load balancers automatically remove failing servers from the traffic pool to protect user experience.


The Core Idea

When a load balancer performs health checks (as we learned in previous lessons), it doesn't just collect information—it acts on it. If a server fails a health check once, that might be a fluke. But if it fails multiple consecutive checks, the load balancer marks that server as "unhealthy" and stops sending traffic to it entirely.

This automatic removal protects your users from experiencing errors or timeouts. The server is taken out of rotation until it starts passing health checks again.

How It Works in Practice

Think of it like a restaurant host managing tables. If one waiter drops two orders in a row, the host stops seating guests at that waiter's tables until they've proven they're back on track.

Here's the typical flow:

  1. Server fails health check #1 → load balancer notes it but keeps trying
  2. Server fails health check #2 → still monitoring, starting to worry
  3. Server fails health check #3 (threshold reached) → marked unhealthy, removed from rotation
  4. Load balancer continues checking the unhealthy server in the background
  5. Server passes several consecutive checks → marked healthy again, traffic resumes

Configuration Matters

Most load balancers let you configure:

  • Failure threshold: How many consecutive failures trigger removal (e.g., 3)
  • Success threshold: How many consecutive passes restore the server (e.g., 2)

These thresholds prevent flapping—servers bouncing in and out of rotation too quickly.

Key Takeaway: Load balancers automatically protect users by removing servers that fail consecutive health checks from the rotation, only restoring them after they prove stability with multiple successful checks.