Load balancer health checks: how strict should they be?
We had an incident where a health check endpoint also checked the database. The database had a short hiccup, every instance failed its health check at once, and the load balancer pulled them all out. A small blip became a full outage.
Now I'm unsure what a health check should actually verify. Just "the process is up"? Dependencies too? Separate liveness and readiness checks?
How do you design yours?
Comments · 3
Splitting liveness and readiness is the usual answer. Liveness should only say whether the process itself is stuck, while readiness can look at dependencies. Even then, a shared dependency failing shouldn't remove every instance at once, so many teams make readiness checks more tolerant or cache the result for a short time.
Short answer: keep the liveness check shallow. If a failing database makes every instance look dead, the load balancer will remove them all and make the incident worse.
We learned the same lesson. Also set healthy and unhealthy thresholds so one failed check doesn't pull an instance. Two or three failures in a row is more stable.