What a health check should tell you.
A green light is useful only when you know exactly what it measures.
A process can be running while its useful work has stopped. It may be listening on a port but unable to read a file, connect to a database, or finish a request. A good health check makes its meaning narrow and explicit.
Start with one question
For a small website, the first question might be: can a visitor retrieve the main page over HTTPS? That check should use the public hostname, follow the expected route, and confirm a small piece of expected content. A successful connection alone does not establish that the right page was served.
Keep that outside view alongside a simpler local check. The two answers help distinguish an application problem from a problem somewhere on the path to it.
Alive and ready are different
A liveness check asks whether a process is able to make progress. A readiness check asks whether it can accept useful work now. Combining both into one endpoint can create surprising behavior.
For example, if a database briefly becomes unavailable, restarting every application process may add work without fixing the database. A readiness failure can take an instance out of rotation while a separate liveness check leaves the process running.
Make failure easy to understand
- Set a timeout so a slow check cannot wait forever.
- Return a clear success or failure status, with a small response body.
- Keep credentials, internal addresses, and detailed diagnostics out of public responses.
- Record enough context privately to explain why the check failed.
A check should also be cheap enough to run repeatedly. Avoid turning a routine probe into an expensive query or a write operation.
Decide what happens next
Detection is only half the design. Decide which failures deserve a retry, which should remove an instance from service, and which should notify a person. A transient failure and a sustained outage should not always lead to the same action.
A useful green light has a sentence behind it.
Write that sentence down. “The public homepage returned the expected document within five seconds” is more informative than “the server is healthy.” It tells you both what you know and what you still need to check.