Skip to content

Commit 6f51831

Browse files
committed
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
1 parent dda8b5d commit 6f51831

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/production-ready-features.adoc

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,50 +1055,62 @@ Also, if an application is using Kubernetes https://kubernetes.io/docs/tasks/run
10551055
[[production-ready-kubernetes-probes-lifecycle]]
10561056
==== Application lifecycle and Probes states
10571057
An important aspect of the Kubernetes Probes support is its consistency with the application lifecycle.
1058-
Spring Boot publishes <<spring-boot-features.adoc#boot-features-application-events-and-listeners,Application Events during startup and shutdown>>.
1058+
There is a significant different between the `AvailabilityState` which is the in-memory, internal state of the application -
1059+
and the actual Probe which exposes that state: depending on the phase of application lifecycle, the Probe might not be available.
1060+
1061+
Spring Boot publishes <<spring-boot-features.adoc#boot-features-application-events-and-listeners,Application Events during startup and shutdown>>,
1062+
and Probes can listen to such events and expose the `AvailabilityState` information.
1063+
1064+
The following tables show the `AvailabilityState` and the state of HTTP connectors at different stages.
10591065
10601066
When a Spring Boot application starts:
10611067
1062-
[cols="3,2,2,6"]
1068+
[cols="2,2,2,3,5"]
10631069
|===
1064-
|Application startup phase |Liveness State |Readiness State |Notes
1070+
|Startup phase |LivenessState |ReadinessState |HTTP server |Notes
10651071
10661072
|Starting
10671073
|`BROKEN`
10681074
|`REFUSING_TRAFFIC`
1075+
|Not started
10691076
|Kubernetes checks the "liveness" Probe and restarts the application if it takes too long.
10701077
10711078
|Started
10721079
|`CORRECT`
10731080
|`REFUSING_TRAFFIC`
1081+
|Accepts requests
10741082
|The application context is refreshed. The application performs startup tasks and does not receive traffic yet.
10751083
10761084
|Ready
10771085
|`CORRECT`
10781086
|`ACCEPTING_TRAFFIC`
1087+
|Accepts requests
10791088
|Startup tasks are finished. The application is receiving traffic.
10801089
|===
10811090
10821091
When a Spring Boot application shuts down:
10831092
1084-
[cols="3,2,2,6"]
1093+
[cols="2,2,2,3,5"]
10851094
|===
1086-
|Application shutdown phase |Liveness State |Readiness State |Notes
1095+
|Shutdown phase |Liveness State |Readiness State |HTTP server |Notes
10871096
10881097
|Running
1089-
|live
1090-
|ready
1098+
|`CORRECT`
1099+
|`ACCEPTING_TRAFFIC`
1100+
|Accepts requests
10911101
|Shutdown has been requested.
10921102
10931103
|Graceful shutdown
1094-
|live
1095-
|unready
1104+
|`CORRECT`
1105+
|`REFUSING_TRAFFIC`
1106+
|New requests are rejected
10961107
|If enabled, <<spring-boot-features#boot-features-graceful-shutdown,graceful shutdown processes in-flight requests>>.
10971108
10981109
|Shutdown complete
1099-
|broken
1100-
|unready
1101-
|The application context is closed and the application cannot serve traffic.
1110+
|N/A
1111+
|N/A
1112+
|Server is shut down
1113+
|The application context is closed and the application is shut down.
11021114
|===
11031115
11041116
TIP: Check out the <<deployment.adoc#cloud-deployment-kubernetes-container-lifecycle,Kubernetes container lifecycle section>> for more information about Kubernetes deployment.

0 commit comments

Comments
 (0)