What is the difference between pm2 restart and pm2 reload

node.jsPm2

node.js Problem Overview


I have a nodejs app running on server.

When should I use pm2 restart,and when should pm2 reload be used?

Referred to the pm2 documention here,but couldn't figure out the difference in use case of the two.

node.js Solutions


Solution 1 - node.js

The difference is documented here:

> As opposed to restart, which kills and restarts the process, reload achieves a 0-second-downtime reload.

The latter means (found here):

> With reload, pm2 restarts all processes one by one, always keeping at least one process running.

It also states that:

> If the reload system hasn’t managed to reload your application, a timeout will fallback to a classic restart.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAyanView Question on Stackoverflow
Solution 1 - node.jsrobertklepView Answer on Stackoverflow