Skip to content
BENIBIX Learn

Health Check

Infrastructure📟 ReliabilityResilient Systems

Also known as Health Check Endpoint, Liveness Probe, Readiness Probe

A small test that asks an app if it is well. Broken copies then get no traffic.

Think of it like

It is like the teacher calling names. If you do not answer, you are marked as away.

Example

Emma's app answers /health with 200 when its database is reachable. When the database link drops, the check fails and the load balancer skips that copy.

Why it matters

Machines use it to spot a broken copy in seconds. A person would take far longer.

Definition

A health check is a small test that asks a running app if it is well. Often it is a web address, like /health, that answers OK when things work. A load balancer or orchestrator calls it every few seconds. If the answer is bad, traffic stops going there, or the app is restarted. Some checks ask if the app is alive, and others ask if it is ready for traffic.

Example code

console
$ curl -i http://localhost:8080/health
HTTP/1.1 200 OK

{"status": "ok"}
A healthy answer. A failing check would return an error code, and traffic would move away.
The failed health check is what told the load balancer to stop sending traffic there.

Common mistake

A health check that only says the app is running. It should also test what the app needs, like its database.

Key takeaways

  1. 1
    Small and fast. It answers in well under a second.
  2. 2
    Checked often. Every few seconds, by a machine.
  3. 3
    Alive or ready. Restart it, or just hold traffic back.