This post was originally published in Portuguese on my blog: Health checks: liveness e readiness no ASP.NET Core .
We've all shipped a service that answered 200 on the health endpoint while Redis was down. Or, worse, an orchestrator that restarted the container in a loop because the health check depended on the database and the database got slow for two minutes. Both problems have the same root: a single "is it healthy?" trying to answer two different questions.
Two questions, two endpoints
The core idea is to separate liveness from readiness . Liveness asks whether the process is up and not stuck; if the answer is no, restarting fixes it. Readiness asks whether this instance can receive traffic right now; if the answer is no, the right move is to take the instance out of the load balancer and wait, without restarting anything. An external dependency being down is a readiness problem, never a liveness one.
In ASP.NET Core you solve this with tags.…