HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How to shut down a stateless app gracefully?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
shutgracefullyappstatelessdownhow

Problem

Quote from CF training on twelve-factor app’s processes are disposable:


Apps should also shut down gracefully (but can also die unexpectedly).
Cloud Foundry stops routing traffic nearly instantaneously to failed
or shutdown instances.

Cloud Foundry apps are stateless. I don't understand how to shut down gracefully a stateless app. A stateless app can always handle kill -9?

Solution

kill -9 is used by the kernel to terminate stateful programs that are no longer responding (including to shutdown requests). To gracefully shut down a stateful app you would use kill -15 which instructs the application to call it's shutdown functions and do the requisite cleanup. If you app is truly stateless, there should be no difference in the results of kill -9 and kill -15, but technically, a graceful shutdown of this program would still be kill -15

Context

StackExchange DevOps Q#2029, answer score: 6

Revisions (0)

No revisions yet.