Health Endpoint Monitoring

Expose an endpoint that reports whether an instance can do its job, so load balancers, orchestrators and monitors can route around problems.

Description

Each instance serves small HTTP endpoints, such as /health/live and /health/ready, that answer quickly with "OK" or "not OK". Load balancers call them every few seconds and stop sending traffic to unhealthy instances; orchestrators restart instances that stay unhealthy; external monitors alert people.

Two questions are worth separating. Liveness: is the process stuck and in need of a restart? Readiness: can it serve traffic right now, with its database reachable and its cache warmed? Mixing them up causes restarts that don't help.

System design

GET /health/ready1quick check2GET /health/ready3503: no DB connection4GET /health5Load balancerUptime monitorchecks from 3 regionsInstance AreadyInstance Bnot readyDatabase

Health Endpoint Monitoring system design diagram

  1. Load balancer (gateway).
  2. Uptime monitor (external service): checks from 3 regions.
  3. Instance A (service): ready.
  4. Instance B (service): not ready.
  5. Database (database).
  6. Step 1: Load balancer → Instance A: GET /health/ready.
  7. Step 2: Instance A → Database: quick check.
  8. Step 3: Load balancer → Instance B: GET /health/ready.
  9. Step 4: Instance B → Load balancer: 503: no DB connection (failure path).
  10. Step 5: Uptime monitor → Load balancer: GET /health.
  1. Every few seconds the load balancer asks each instance whether it's ready.
  2. Instance A checks its own database connection quickly (results cached for a few seconds) and answers 200.
  3. The load balancer asks instance B the same question.
  4. Instance B has lost its database connection and answers 503. The load balancer stops sending it traffic until it recovers; its liveness check still passes, so it isn't restarted for a problem a restart can't fix.
  5. An external monitor checks the public endpoint from several regions and alerts someone if the whole service stops answering.
AWS
ALB/NLB target group health checks; ECS and EKS liveness/readiness probes; Route 53 health checks; CloudWatch Synthetics.
Azure
Application Gateway and Front Door health probes; App Service health check; AKS probes; Application Insights availability tests.
Google Cloud
Load balancer health checks; Cloud Run and GKE probes; Cloud Monitoring uptime checks.

When to use it

Use it when

  • Any service behind a load balancer or running on an orchestrator such as Kubernetes or ECS.
  • You want failing instances taken out of rotation automatically, before users notice.
  • You need external uptime checks for alerts and status pages.

Avoid it when

  • Never skip it for production services. Instead, avoid making the checks too clever: deep checks that call every downstream system on every probe.

Pitfalls

  • Liveness checks that test dependencies: the database is down, so every instance is "dead" and gets restarted in a loop, which fixes nothing. Liveness should check only the process itself.
  • Expensive health checks that load the very database they monitor. Cache dependency results for a few seconds.
  • Health endpoints exposing internals (versions, hostnames, errors) to the internet. Keep detail on an internal endpoint.
  • Checks that always return 200. Make sure they fail when the instance genuinely can't serve.

Alternatives

Synthetic transactions

Choose it when you want to verify a real user journey end to end, such as logging in and adding to the cart, not just instance health.

Circuit Breaker

Choose it when callers should react to a dependency failing, rather than infrastructure routing around an instance.

Metrics and alerts

Choose it when you want to catch degraded behaviour, such as rising latency or error rate, that a binary health check misses.