Health Check of Microservices

Health check of microservices helps in ensuring and maintaining the defined requirements related to the capacity of the system which cannot be ignored.

To update the availability status of a service, health check of a service can use Pull or push model however Push model is the better option as it is the responsibility of the service to update its availability status in registry.

There are many libraries available which can be used when creating health check endpoint in microservice which provides the current health status of an API by checking that the service and its dependencies are alive/running to accept requests and responds.

And, it is beneficial to use orchestrators like Kubernetes, Service Fabric, etc. which periodically checks the health of the microservices by sending requests to their health check endpoints and provides reporting metrics & other options to observe the health of microservices.

It is recommended not to implement health check endpoint which is only responsible for returning the response with HTTP Status 200 as it is not going to help in long run nor going to solve the purpose of having health check endpoint in a microservice. Health check endpoint should return the current status of the service as well as the status of all the dependencies which are required to run that service like status of external service (if used), status of file system (available and used space), status of database, etc.
Please share this

Leave a Reply