Posts

Showing posts from December, 2019

Service health checks - the right way to build them

Service health checks are ubiquitous. If you have built any software that relies upon any upstream service, I am sure you would have used some form of health check. Your software could be a stand alone program or it could be a proxy. You may also have built and exposed a service that is used as an upstream service by another software. The worst way to perform health check is to pull a resource (like GET /hc.html, if your service is exposed as a HTTP service) or perform a TCP connect check in the same port where data is served . These are checks I call as in-band health checks .  Please don't do these. Based on my experience, the best way to expose health checks is by using an out-of-band mechanism. This means that you expose another port for performing health check. The client can perform a HTTP check or TCP check in the health check port. As a convenience, if you expose health check as HTTP service in health check port, you can consolidate multiple health checks like: GET /he