Fix docs on probe state during graceful shutdown

This commit improves the "Application lifefycle and Probes states"
section and underlines the difference between `AvailabilityState` and
the availability of Probes over HTTP.

Closes gh-24843
pull/24986/head
Brian Clozel 4 years ago
parent dda8b5d287
commit 6f51831001

@ -1055,50 +1055,62 @@ Also, if an application is using Kubernetes https://kubernetes.io/docs/tasks/run
[[production-ready-kubernetes-probes-lifecycle]] [[production-ready-kubernetes-probes-lifecycle]]
==== Application lifecycle and Probes states ==== Application lifecycle and Probes states
An important aspect of the Kubernetes Probes support is its consistency with the application lifecycle. An important aspect of the Kubernetes Probes support is its consistency with the application lifecycle.
Spring Boot publishes <<spring-boot-features.adoc#boot-features-application-events-and-listeners,Application Events during startup and shutdown>>. There is a significant different between the `AvailabilityState` which is the in-memory, internal state of the application -
and the actual Probe which exposes that state: depending on the phase of application lifecycle, the Probe might not be available.
Spring Boot publishes <<spring-boot-features.adoc#boot-features-application-events-and-listeners,Application Events during startup and shutdown>>,
and Probes can listen to such events and expose the `AvailabilityState` information.
The following tables show the `AvailabilityState` and the state of HTTP connectors at different stages.
When a Spring Boot application starts: When a Spring Boot application starts:
[cols="3,2,2,6"] [cols="2,2,2,3,5"]
|=== |===
|Application startup phase |Liveness State |Readiness State |Notes |Startup phase |LivenessState |ReadinessState |HTTP server |Notes
|Starting |Starting
|`BROKEN` |`BROKEN`
|`REFUSING_TRAFFIC` |`REFUSING_TRAFFIC`
|Not started
|Kubernetes checks the "liveness" Probe and restarts the application if it takes too long. |Kubernetes checks the "liveness" Probe and restarts the application if it takes too long.
|Started |Started
|`CORRECT` |`CORRECT`
|`REFUSING_TRAFFIC` |`REFUSING_TRAFFIC`
|Accepts requests
|The application context is refreshed. The application performs startup tasks and does not receive traffic yet. |The application context is refreshed. The application performs startup tasks and does not receive traffic yet.
|Ready |Ready
|`CORRECT` |`CORRECT`
|`ACCEPTING_TRAFFIC` |`ACCEPTING_TRAFFIC`
|Accepts requests
|Startup tasks are finished. The application is receiving traffic. |Startup tasks are finished. The application is receiving traffic.
|=== |===
When a Spring Boot application shuts down: When a Spring Boot application shuts down:
[cols="3,2,2,6"] [cols="2,2,2,3,5"]
|=== |===
|Application shutdown phase |Liveness State |Readiness State |Notes |Shutdown phase |Liveness State |Readiness State |HTTP server |Notes
|Running |Running
|live |`CORRECT`
|ready |`ACCEPTING_TRAFFIC`
|Accepts requests
|Shutdown has been requested. |Shutdown has been requested.
|Graceful shutdown |Graceful shutdown
|live |`CORRECT`
|unready |`REFUSING_TRAFFIC`
|New requests are rejected
|If enabled, <<spring-boot-features#boot-features-graceful-shutdown,graceful shutdown processes in-flight requests>>. |If enabled, <<spring-boot-features#boot-features-graceful-shutdown,graceful shutdown processes in-flight requests>>.
|Shutdown complete |Shutdown complete
|broken |N/A
|unready |N/A
|The application context is closed and the application cannot serve traffic. |Server is shut down
|The application context is closed and the application is shut down.
|=== |===
TIP: Check out the <<deployment.adoc#cloud-deployment-kubernetes-container-lifecycle,Kubernetes container lifecycle section>> for more information about Kubernetes deployment. TIP: Check out the <<deployment.adoc#cloud-deployment-kubernetes-container-lifecycle,Kubernetes container lifecycle section>> for more information about Kubernetes deployment.

Loading…
Cancel
Save