Health check

In the microservices world, instances can start, change, update, and stop at random. They can also scale up and down based on their traffic and other settings. This requires a health check service that will constantly monitor the availability of the services.

Services can send their status periodically to this health check service, and this keeps a track of the health of the services. When a service goes down, the health check service will stop getting the heartbeat from the service. Then, the health check service will mark the service down and cascade the information to the service registry. Similarly, when the service resumes, the heartbeat is sent to the health check service. Upon receiving a few positive heartbeats, the service is marked UP and then the information is sent to the service registry.

The health check service can check for health in two ways:

This also requires a high availability system. All the services should connect to this service to share their heartbeat and this has to connect to the service registry to tell them whether a service is available or not.