I am using PM2 to manage my Node servers. When I say pm2 restart 0, it restarts my app, but I get 5-10 seconds of downtime. How can I implement a zero down time deployment or at least minimise this downtime?
Also what's the difference between pm2 reload and pm2 restart?
Thanks folks!
We had this question here already a month ago :-)
Sandeep Panda
co-founder, Hashnode
The simplest way to do this in PM2 is to start your server in cluster mode. Use the following pm2 command to do this :
The above command will spawn a child process in cluster mode so that later on you can reload your app by using the following command :
Now PM2 will attempt to reload your process without any downtime. If due to some reason, PM2 can't reload the app, it'll fallback to a restart.
More Info