This is assumed to be in a webapp/SaaS context where there is plenty of http/https traffic already.
-
Do as little work in your health check as possible. It is like a CPU interrupt in that way.
-
Respond with an http status of 200 if all is well. Respond with 500 if there is a failure.
-
Optionally also include JSON in your response.
{ "status": "green", "name": "foo", "totalPipelines": 20, "totalSessions": 10, "avgResponseMs": 10 }
-
If your web app stops acceptign connections when it gets busy then a side-channel is needed. Typically this would be done by creating a new http service on a new port that is able to determine the health of the web app of interest.
- Monitoring checklist - What things should I be monitoring? has good insights for which metrics to choose
- haproxy docs on health checks
- Is there a standard way to check if a web API is alive? hints that more stuff like this document is desperately needed.