Graceful shutdown
Graceful shutdown is an orderly termination process that stops or limits new work, allows ongoing work to finish, and performs necessary cleanup before exit.
Elixir in Action, Third Edition
Graceful termination is the controlled shutdown of a process that allows it to perform final cleanup before exiting.
- How it is used
- Uses controlled process termination to stop supervision trees without leaving dangling processes.
- How deep it goes
- Explains propagation, GenServer callbacks, exit trapping, timeout choices, and forceful termination boundaries.
- Examples
- Uses a top-level supervisor, nested supervisor trees, GenServer terminate/2, and shutdown values including 5_000, :infinity, and :brutal_kill.
- What you can do after
- Operate/configure supervised workers with cleanup callbacks and bounded, indefinite, or immediate shutdown behavior.
Read how Elixir in Action, Third Edition explains graceful shutdown →
Kubernetes for Developers
A graceful shutdown is an orderly process termination that stops accepting new work and allows in-progress work to finish.
- How it is used
- Protects in-progress web requests, batch jobs, and queue tasks during Pod replacement, node upgrades, and other disruptions.
- How deep it goes
- Explains SIGTERM handling, polling, workload behavior, and Kubernetes timing, but stops short of fault tolerance and complete queue design.
- Examples
- Uses a Python Redis-backed worker, a two-replica Deployment, a 120-second termination window, and web-request and batch-job scenarios.
- What you can do after
- Operate/configure Kubernetes workloads that stop accepting work and finish active requests or tasks before termination.
Read how Kubernetes for Developers explains graceful shutdown →
Kubernetes in Action, Second Edition
A graceful shutdown is an orderly termination procedure that stops accepting new work and allows in-progress work to complete before exit.
- How it is used
- Uses Kubernetes container lifecycle hooks to let application work finish before termination.
- How deep it goes
- Explains the pre-stop and SIGTERM sequence, demonstrates Nginx behavior, and notes that hook failure does not prevent termination.
- Examples
- Demonstrates nginx -s quit and a YAML preStop exec hook for an Nginx container.
- What you can do after
- Operate/configure Nginx containers to stop accepting connections and complete in-flight requests before exit.
Read how Kubernetes in Action, Second Edition explains graceful shutdown →
Go in Practice, Second Edition
A graceful shutdown is an orderly termination procedure that allows active work and resources to be completed or released before a service stops.
- How it is used
- Protects active HTTP requests and cleanup work when stopping a web server.
- How deep it goes
- Explains signal channels, goroutines, and Shutdown behavior, while deferring deeper concurrency details.
- Examples
- Uses a Go HTTP server on port 8080 with a Hello World handler and a signal-driven Shutdown call.
- What you can do after
- Operate a Go HTTP server that drains active requests after receiving an operating-system signal.
Read how Go in Practice, Second Edition explains graceful shutdown →
Also covered in
- Rust Web Development
- Designing AI SystemsIn early access (MEAP)
- Practical Automation with PowerShell: Effective scripting from the console to the cloud
- Fast Python: High performance techniques for large datasets
- Spring in Action, Sixth Edition
- Akka in Action, Second Edition
- Python Concurrency with asyncio
What to know first
- rolling updateA rolling update incrementally updates or replaces instances or resources rather than changing them all at once, often allowing service to continue during the transition.
Related concepts
- termination grace periodconfigured by · A termination grace period is the time Kubernetes allows a Pod's containers to shut down gracefully before forcibly terminating them.
- signaluses · An operating-system signal is an asynchronous notification delivered to a process to report an event or request handling.
Questions about graceful shutdown
What is graceful shutdown?
Graceful shutdown is an orderly termination process that stops or limits new work, allows ongoing work to finish, and performs necessary cleanup before exit.
Which Manning books explain graceful shutdown?
Elixir in Action, Third Edition, Kubernetes for Developers, Kubernetes in Action, Second Edition and Go in Practice, Second Edition.
What should I know before learning graceful shutdown?
Manning books that teach graceful shutdown usually introduce rolling update first.
What is graceful shutdown also called?
Graceful shutdown is also called graceful termination.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



