Node.js › Clustering & Worker Threads
How does zero-downtime restart work with Node's cluster module or PM2, and why is it important for production deployments?
AdvancedAnswer
Zero-downtime restart replaces workers one at a time -- each old worker finishes in-flight requests and stops accepting new ones while a new worker starts, so at every point some workers remain available, meaning no dropped requests during a deployment.
pm2 reload my-app
// PM2 starts a new worker, waits for it to be ready, then gracefully
// shuts down one old worker at a time until all run the new codeReal-world example An e-commerce API deploys several times daily using 'pm2 reload' rather than 'pm2 restart', so customers mid-checkout never experience a dropped connection during routine deployments.