liveBook · Manning

Liveness check

As explained in Designing AI Systems

A liveness probe is a health-check interface that indicates whether a running service instance is alive and able to be managed by infrastructure.

A liveness check is a shallow health endpoint that reports whether a running service process remains responsive and can be managed by infrastructure. It returns HTTP 200 while the server is running and able to handle requests. If the process deadlocks, runs out of memory, or enters an unrecoverable state, the orchestrator treats the failed check as a reason to restart the container. section 9.3.3

Use liveness checks for recovery, while keeping them separate from readiness checks:

  • Liveness asks whether the process is alive and functional enough to handle requests; it does not ask whether dependencies are healthy. section 9.3.3
  • Readiness asks whether the container should receive traffic. Startup can leave a container live but not ready while modules, platform instances, or gateway connections initialize. section 9.3.3
  • During graceful shutdown, failing readiness removes the container from load balancing while in-flight requests finish; liveness remains a separate recovery mechanism. section 9.3.3
  • Kubernetes Deployments attach liveness and readiness probes to containers, replace containers that fail liveness, and maintain the desired replica count. section 9.7

Container lifecycle

A workflow container starts and returns a failed readiness result until initialization completes. It then accepts traffic. If the process later deadlocks, its liveness check fails and Kubernetes replaces it. During deployment shutdown, readiness fails first so new requests stop arriving before the container exits. section 9.3.3 section 9.7

Keep the check deliberately shallow. Testing a gateway channel or making a dependency call would couple container recovery to dependency health; broader system health belongs in telemetry-based service-health reporting. section 9.3.3 section 7.3.1

How Designing AI Systems covers it

How deep it goes
Explains status semantics, failure cases, shutdown boundaries, and dependency-scope tradeoffs, but stops short of implementation code.
Examples
Uses startup initialization, deadlock recovery, graceful shutdown, and Kubernetes rolling deployment as operational examples.
What it assumes
Assumes familiarity with containers, orchestrators, HTTP status checks, and traffic routing during startup and shutdown.
What you can do after
Operate containerized services with separate liveness and readiness behavior and avoid coupling restarts to dependency health.
How it connects
Connects liveness checks to readiness probes, container orchestration, Kubernetes Deployments, rolling updates, and service health.

Also explained in

Compare how 8 books explain liveness check →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing AI Systems. The section links point to the parts of the book it draws on.