Deployment Health Checks
Deployment health checks verify that newly deployed instances meet readiness and operational criteria before rollout continues. They help prevent unhealthy application instances from receiving production traffic or causing a rollout to proceed too far.
A deployment health check is a set of automated checks used during or immediately after releasing a new application version. For a Java backend, checks commonly verify that the process starts, dependencies are usable, and the application can serve expected requests.
A readiness check answers whether an instance is safe to receive traffic. A liveness check answers whether the process is still functioning well enough to remain running. These checks can be used by deployment infrastructure, load balancers, or orchestration systems to decide whether an instance should participate in service traffic.
During a rolling deployment, the system can wait for new instances to become healthy before replacing more old instances. If health checks fail, the rollout can pause or be stopped, limiting the number of unhealthy instances introduced at once.
Health checks should test meaningful operational conditions without depending on unnecessarily fragile or expensive operations. For example, a readiness endpoint might verify that required initialization has completed, while deeper dependency tests may be performed separately depending on the architecture.
Key points
- Readiness determines whether an instance should receive traffic.
- Liveness determines whether an instance is still functioning and may need restarting.
- Deployment systems can use health results to pause or stop a rollout.
- Checks should be fast, reliable, and representative of actual service availability.
Interview questions
How would health checks affect a rolling deployment?
A rolling deployment can create a new instance and wait for its health checks to pass before replacing additional old instances. If the new instance repeatedly fails, the rollout can pause or stop instead of spreading the bad version across the fleet. This reduces the blast radius of a faulty release.
What is a deployment health check?
It is an automated check that determines whether a newly deployed application instance is operating correctly enough for the deployment to continue. It can verify that the process is running and that the application is ready to serve requests. Deployment infrastructure can use the result to pause or stop a rollout when instances are unhealthy.
What is the difference between readiness and liveness?
Readiness indicates whether an instance should receive production traffic. Liveness indicates whether the running instance is still functioning and may need to be restarted. An application can therefore be alive but not ready, such as while it is still initializing.
What makes a good readiness check for a Java backend?
A good readiness check is fast, deterministic, and closely related to the application's ability to handle real traffic. It should verify essential initialization and critical local state without performing unnecessarily expensive work on every probe. If a mandatory dependency is unavailable and the application cannot serve requests without it, that condition may need to affect readiness.