📟Health Check
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
Example code
console
$ curl -i http://localhost:8080/health
HTTP/1.1 200 OK
{"status": "ok"}Common mistake
Key takeaways
- 1Small and fast. It answers in well under a second.
- 2Checked often. Every few seconds, by a machine.
- 3Alive or ready. Restart it, or just hold traffic back.