0

Hi I am making api server with nodejs and pm2.

I have a question.

is it possible to zero-downtime with only one pm2 fork mode instance using the pm2 reload command?

Or is it essential to have two instances of pm2 cluster mode to implement zero downtime?

let me know thanks!

syoo
  • 23
  • 4
  • Do you mean "How can I maintain at least one operational instance if one crashes?" – tadman Feb 10 '21 at 05:42
  • My question is, is it possible to zero-downtime with only one pm2 fork mode instance using the pm2 reload command? Or is it essential to have two instances of pm2 cluster mode to implement zero downtime? – syoo Feb 10 '21 at 05:49
  • I think reload is only effective in cluster mode with atleast 2 instances – Nidhin David Feb 10 '21 at 06:00
  • Not actual zero downtime - that requires clustering because PM2 will need to manage the incoming port and forward packets to your script. If you execute two scripts at the same time without clustering you would get an EADDRINUSE error. But generally I don't worry about zero downtime with node.js because even without zero downtime normal node.js is almost zero downtime due to the very low server startup time – slebetman Feb 10 '21 at 07:48
  • This sounds like something that should be solved at a higher level, like with Nginx load-balancing, or Kubernetes. – tadman Feb 10 '21 at 18:57

0 Answers0