Skip to main content

What is graceful shutdown in Node.js?

Mid NodeJS
Quick Answer Graceful shutdown means when your Node.js process receives a SIGTERM (from a deployment or scaling event), it stops accepting new connections, finishes in-flight requests, closes database connections, and then exits cleanly. Without it, active requests are abruptly cut off. Use process.on('SIGTERM', () => server.close(done)) pattern with a timeout.

Answer

Graceful shutdown stops accepting new requests, finishes in-flight work, and closes resources before exit.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice