Skip to content

Health Check Patterns

Medium — good to knowNetworking

ELI5 — The Vibe Check

Health checks are like the doctor's checkup for your servers. The load balancer periodically asks 'are you alive? are you healthy?' and routes traffic only to servers that respond positively. Sick servers get taken off the roster.

Real Talk

Patterns for monitoring service health in distributed systems. Liveness checks verify a service is running; readiness checks verify it can serve traffic; deep health checks verify dependencies (database, cache) are accessible. Health checks are used by load balancers, Kubernetes, and service meshes to route traffic and trigger restarts.

Show Me The Code

// Express health check endpoint
app.get('/health', (req, res) => {
  res.json({ status: 'ok' });
});

app.get('/health/ready', async (req, res) => {
  try {
    await db.query('SELECT 1');
    res.json({ status: 'ready', db: 'connected' });
  } catch (e) {
    res.status(503).json({ status: 'not ready' });
  }
});

When You'll Hear This

"The load balancer hits /health every 10 seconds and removes servers that fail 3 consecutive checks." / "Separate liveness from readiness checks — a service can be alive but not ready to serve traffic."

Made with passive-aggressive love by manoga.digital. Powered by Claude.