The most important thing here is to understand the difference between liveness and readiness checkers:
- Liveness: It just shows whether your service is available or not.
- Readiness: It shows not only whether your service is available, but also whether it's ready to process requests.
Both situations have practical use cases.
You can use liveness just to monitor the health state of your single microservice. For example, if it is running under a Kubernetes cluster and it's liveness health check stops responding, Kubernetes can eliminate its pod and create another one.
On the other hand, you can use readiness to check some resources that your microservice need to respond to a request. It may needs to access a database, request a third-party service, or consume a message from a queue; if these resources are available, it will answer with I'm up and ready! but if they are not, it will return I'm up, but not ready....