Scrivio Interview library
ConceptFoundations8 min read · updated 13 November 2026

A load balancer must stop sending traffic to broken backends. Active health checks probe each backend on a schedule; passive checks, also called outlier detection, watch real traffic for errors.

Explain both kinds, how interval and thresholds decide detection time, and what a health endpoint should check.

Active health checks send a probe such as GET /health to every backend on a fixed interval, remove a backend after a number of consecutive failures and bring it back after a number of consecutive successes. Passive checks, or outlier detection, watch real traffic and eject a backend that returns errors. Detection time is roughly the interval times the unhealthy threshold plus timeouts, and the endpoint itself should answer only one question: can this instance serve traffic right now?

Why this question is asked

Every service behind a load balancer will, sooner or later, have an instance that crashes, hangs or half works. How quickly the balancer notices decides how many users see errors, and what the health endpoint checks decides whether a small problem stays small. Interviewers ask this because the defaults look harmless and the mistakes only show up during an incident. In this answer, we will recap what a load balancer does with health information, look at active checks and how their settings add up to a detection time, then at passive checks, and finally at what a good health endpoint should and should not check.

1A Quick Recap: Why the Balancer Needs Health Information

A load balancer receives requests and spreads them across a pool of backends, the instances of our service. It keeps a list of which backends are in rotation, meaning eligible to receive traffic. If a backend dies and stays in that list, roughly one request in every N goes to a dead machine, where N is the size of the pool.

So the balancer needs a way to learn that a backend is broken and to take it out, and later to learn that it has recovered and put it back. There are two sources of that information. It can ask each backend directly, which is an active check, or it can watch how the backend answers real requests, which is a passive check. Most production setups use both.

2How Active Health Checks Work

With an active check, the balancer sends its own probe to every backend on a schedule, for example GET /health every 10 seconds. Four settings control it. The interval is how often it probes. The timeout is how long it waits for an answer before counting the probe as failed. The unhealthy threshold is how many consecutive failures take a backend out of rotation, and the healthy threshold is how many consecutive successes put it back. Requiring several results in a row in both directions stops a single slow probe from removing a healthy instance, and stops a single lucky probe from bringing back a broken one.

Here is the same idea in HAProxy, which spells the thresholds as fall and rise.

Java
backend orders
option httpchk GET /actuator/health/readiness
timeout check 2s # a probe slower than 2s counts as failed
server app1 10.0.1.11:8080 check inter 10s fall 3 rise 2
server app2 10.0.1.12:8080 check inter 10s fall 3 rise 2
# inter 10s: probe every 10 seconds
# fall 3: 3 failures in a row -> out of rotation
# rise 2: 2 successes in a row -> back in rotation
Step throughLife of one backend under active checks
  1. Probe GET /health every 10 stimeout 2 s
  2. Probe failed?
    YesAdd 1 to the failure countNoReset failures, add 1 to successes
  3. 3 failures in a row?
    YesRemove from rotationNoKeep sending traffic
  4. Out of rotation: 2 successes in a row?
    YesPut back in rotationNoKeep probing

4 steps in order. Play them, or step through them one at a time.

The thresholds make the balancer wait for a pattern, not a single result.

Cloud balancers have the same four knobs under other names. An AWS target group, for example, has a health check interval, a timeout, an unhealthy threshold count and a healthy threshold count. Once we understand the four, we can read any balancer's settings.

3How the Settings Decide Detection Time

Now we can work out how long a dead backend keeps receiving traffic. In the worst case it dies just after passing a probe. The balancer needs three failed probes, and they come 10 seconds apart, so the third failure arrives about 30 seconds after the death. If the backend hangs instead of refusing connections, each failed probe also waits for the 2-second timeout, which adds a little more. So with a 10-second interval and a threshold of 3, a dead backend can receive traffic for 30 seconds or more.

The table shows how the choices trade speed against noise. A shorter interval and a lower threshold detect faster, but they also remove instances during a brief garbage collection pause or a short network blip, and every removal pushes extra load onto the rest of the pool.

Interval, threshold and worst-case detection
IntervalUnhealthy thresholdTimeoutDead backend still gets traffic for
5 s22 sabout 10 to 14 s
10 s32 sabout 30 to 36 s
30 s35 sabout 90 to 105 s
30 s55 sabout 150 to 175 s
Detection time is roughly interval times threshold, plus the timeout of each failed probe.

Recovery is slower in the same way. With rise 2 and a 10-second interval, a repaired instance waits about 20 seconds before it gets traffic again. That delay is deliberate: we want the instance to prove it is stable before users depend on it.

4Passive Checks: Watching Real Traffic

A passive check, also called outlier detection, sends no probes. The balancer looks at the responses to real requests, and when a backend shows a pattern such as five consecutive 5xx responses or repeated connection errors, it ejects that backend for a period, for example 30 seconds, and then lets it try again. Envoy calls this outlier detection, and open source NGINX does a simpler version with max_fails and fail_timeout on each upstream server.

The reason passive checks matter is that a probe tests one cheap path. An instance with a corrupted cache, a full disk for uploads or a broken connection to one partner can answer GET /health perfectly while failing a large share of real requests. Passive checks see those failures because they look at what users actually get.

YAML
# Envoy cluster: eject a host after 5 consecutive 5xx answers
outlier_detection:
consecutive_5xx: 5 # 5 errors in a row -> eject
interval: 10s # how often ejection decisions are evaluated
base_ejection_time: 30s # first ejection lasts 30 s, repeat ejections last longer
max_ejection_percent: 10 # never eject more than 10 percent of hosts

Notice the last line. Passive checks need a limit on how much of the pool they may remove, because a shared problem makes every host return errors, and ejecting all of them would turn a partial failure into a full one.

5What the Health Endpoint Should Check

The endpoint the balancer probes should answer one narrow question: can this instance serve traffic right now? That means the process is up and responding, it has finished starting, it is not so overloaded that it should shed new work, and the local resources it needs, such as a warmed cache or loaded configuration, are ready. The check must be cheap and fast, because it runs every few seconds on every instance, and a heavy check becomes load of its own.

In Spring Boot, Actuator already separates these ideas. The readiness group reports whether the application is ready to accept traffic, and by default it does not include the database or other external systems. The plain /actuator/health endpoint, on the other hand, rolls up every health indicator, including the database, so pointing a balancer at it is a common mistake.

Properties
# application.properties
management.endpoint.health.probes.enabled=true
# exposes /actuator/health/liveness and /actuator/health/readiness
management.endpoint.health.group.readiness.include=readinessState
# readiness reflects this instance only, not the shared database

The thing to avoid is checking shared dependencies in the balancer's check. If every instance's check calls the same database, a database slowdown makes every instance fail at the same moment, and the balancer removes the whole pool. Requests that did not even need the database then fail too. Dependency problems belong in metrics, alerts and error handling inside the service, not in the signal that decides whether an instance exists.

6Follow-up questions

How does this differ from a Kubernetes liveness probe?

A liveness probe answers a different question: is this process stuck so badly that it should be restarted? If it fails, the kubelet kills and restarts the container. A readiness probe is the one that matches a load balancer check: if it fails, the pod is removed from the Service endpoints but keeps running. So a liveness probe must be even more conservative than readiness. It should fail only for states a restart would fix, such as a deadlock, and never because a dependency is down, otherwise a database outage restarts every pod in a loop.

Why not set the unhealthy threshold to 1 for the fastest detection?

Because single probes fail for harmless reasons: a garbage collection pause, a dropped packet or a brief CPU spike. With a threshold of 1, instances would drop out and come back all day, and each removal shifts load onto the others, which can make them slow enough to fail their own probes. A threshold of 2 or 3 with a shorter interval usually detects just as quickly with far less noise, and passive checks cover the fast cases.

7Conclusion

In this answer, we saw that active checks probe each backend on an interval and use consecutive failure and success thresholds to remove and restore it, which makes detection time roughly the interval times the threshold plus timeouts, 30 seconds or more with 10 seconds and 3. Passive checks watch real responses and catch failures a simple probe misses, as long as ejection is capped. And the health endpoint should be cheap and shallow, reporting whether this instance can serve, never the state of shared dependencies.

What to say in the interviewAbout 90 seconds aloud

Open with

There are two ways a load balancer learns that a backend is broken. Active health checks probe each backend on an interval, say GET /health every 10 seconds with a 2-second timeout.

Then, if they want more

After a number of consecutive failures, the unhealthy threshold, the backend is removed, and after a number of consecutive successes, the healthy threshold, it comes back. That means detection time is roughly interval times threshold plus timeouts, so with 10 seconds and a threshold of 3 a dead instance can still get traffic for 30 seconds or more.

Passive checks, or outlier detection, watch real traffic instead, for example five consecutive 5xx responses or connection errors, and eject the host for a while. They catch gray failures that a probe misses, like a bad cache that breaks 30 percent of requests, but I would cap how many hosts can be ejected.

For the endpoint itself, I want it cheap and shallow: the process is up, startup is finished, it is not overloaded, and local resources are ready. In Spring Boot I point the balancer at the readiness group, not the full /actuator/health, because the full one includes the database.

I never put shared dependencies in the balancer's check, because a database slowdown would then fail every instance at once and the balancer would remove the whole pool.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Explain both kinds, how interval and thresholds decide detection time, and what a health...": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/19027278d8/