Using Spring Boot’s support for graceful shutdown and probes for liveness and readiness
Back in Spring Boot v2.3, a couple of useful features were added to support Deployments to Kubernetes:
- Graceful shutdown:
Whenever a microservice instance needs to be stopped, for example, in a rolling upgrade scenario, there is a risk that active requests are affected when the instance is stopped. To minimize this risk, Spring Boot has added support for graceful shutdown. When applying graceful shutdown, a microservice stops accepting new requests and waits for a configurable time for active requests to complete before it shuts down the application. Requests that take a longer time to complete than the shutdown wait period will be aborted. These requests will be seen as exceptional cases that a shutdown procedure can’t wait for before it stops the application.
Graceful shutdown has been enabled with a waiting period of 10 seconds for all microservices by adding...