Comparison
Graceful shutdownvsSession affinity
Graceful shutdown
on SIGTERM you stop accepting new requests, finish the ones in flight, and only then exit.
Ending a process in a way that does not drop work: deregister from the load balancer, stop accepting, complete in-flight requests, close connections, exit. Without it, every deploy sheds a burst of errors proportional to your request rate. The grace period must exceed your longest normal request, or the platform kills you mid-request anyway.
Full entry →Session affinity
you pin each user to the same instance so the state cached in that process is still there on their next request.
Routing a client's requests consistently to one backend. It makes in-process state usable, which is sometimes the only practical option for WebSockets or large session data. It also breaks even load distribution, prevents clean draining on deploy, and turns one instance's death into a visible failure for a subset of users.
Full entry →