(Note · · 5 min read)

The health check was green the whole time it was down

The endpoint returned two hundred for the entire incident. It was answering truthfully — the process was up. It was not checking the database, the queue, the disk or the third party the product depends on, so it had nothing to say about whether the product worked.

By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka

Separate liveness from readiness

Two different questions get collapsed into one endpoint. Is the process alive, which decides whether to restart it, and can it serve traffic right now, which decides whether to send requests to it.

Conflating them causes a specific bad failure: a dependency goes down, the combined check fails, the orchestrator restarts a perfectly healthy process, and the restart does nothing because the dependency is still down. Keep liveness cheap and local; put dependency checks in readiness.

Check the thing the product needs

A useful check does a small amount of real work: a trivial query against the database, a read of the cache, a write to the directory that must be writable. Not a full query — a cheap one that would fail if the connection were gone.

For a mail platform, the honest check is whether mail flows in both directions, not whether the service is listening. On the one I run, hourly checks cover delivery and the things that silently break it, including whether the sending address has appeared on a blocklist — a failure with no symptom on the server at all.

Check from outside

A check running on the same machine shares its fate: if the host is unreachable, nothing reports, and silence looks identical to health. Run the check from somewhere else, over the path a user takes, including DNS and the certificate.

The same principle applies to backups, which is why the ones for that platform are pulled by an outside machine rather than pushed from the server. A server that cannot be reached cannot tell you that it is failing to send anything.

Test the alert path, not just the check

The check noticing is half the system. The other half is the message arriving at a person, and that half fails quietly: a wrong address, an expired token, a notification routed to a channel nobody watches, alerts going to the very mail server that is down.

So trigger it deliberately and confirm the alert arrives. An untested alert path is a monitoring system you are trusting on the basis of having configured it. Re-test after changing where alerts go.

Fail fast, and do not amplify

Give every dependency check a short timeout. A check that hangs for thirty seconds against a slow database turns a degradation into an outage, because the load balancer concludes nothing has responded.

Keep the check cheap enough to run as often as it is polled, and do not let it do heavy work — a frequently polled expensive check becomes load the system has to serve while already struggling.

Report which dependency, not just a failure

A readiness response naming the component that failed turns the first minute of an incident into reading one line instead of guessing. Keep it behind authentication, because a public endpoint listing your dependencies and their states is also reconnaissance.

And distinguish degraded from down. A system that can serve reads but not writes is in a state worth knowing about, and a boolean cannot express it.

Common questions

Why was my health check green during an outage?

Because it only proved the process was running. A check that does not touch the database, queue, disk or the third parties the product depends on has nothing to say about whether the product works.

What is the difference between liveness and readiness?

Liveness asks whether the process is alive, deciding whether to restart it; readiness asks whether it can serve traffic now. Combining them makes a dependency outage restart a healthy process, which fixes nothing. Keep liveness cheap and local.

Should health checks run on the same server?

Not only there. A check sharing the host's fate reports nothing when the host is unreachable, and silence looks like health. Check from outside over the path a user takes, including DNS and the certificate.

Does the alert path need testing?

Yes, and it is the half that fails quietly — a wrong address, an expired token, a channel nobody watches, or alerts routed through the mail server that is down. Trigger it deliberately, confirm arrival, and re-test after changing where alerts go.

Need something like this built?