Skip to content
Health Checks
step 1/5

Reading — step 1 of 5

Read

~1 min readHealth & Lookup

Health Checks

A registered service might be UP but UNHEALTHY (DB connection broken, deadlocked, etc.). Discovery should hide unhealthy instances from clients.

Three styles:

1. TTL-based (last lesson): instance must renew. No content check; just liveness.

2. Active probe: discovery agent periodically sends health request:

GET http://service:8080/health

Service returns 200 OK if healthy, anything else if not.

Variants:

  • HTTP probe
  • TCP probe (just check port open)
  • Script probe (run a custom command)
  • gRPC health-check protocol (grpc.health.v1.Health.Check)

3. Application-driven: service tells the registry its status:

PUT /v1/agent/check/pass/check_id
PUT /v1/agent/check/fail/check_id

Used when health requires app-specific knowledge (DB queryable? cache warm?).

Health states:

  • passing / healthy: serve traffic
  • warning: serve traffic but alert ops
  • critical / failing: don't serve

Some systems graduate: warn → fail after N consecutive failures (avoid flapping).

Production: combine TTL (for liveness) + active probe (for content health). Each catches different failures.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…