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.
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.
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.
reload
will keep the old worker running, so it wouldn't be noticable. –
Cath restart
is faster, and if you don't care about 0-second downtime it might be preferable. –
Cath reload
should be used always with stateless applications. It is also documented now that reload
will fallback to restart
after a timeout. –
Bingaman reload
! –
Femmine reload
will break it so you must use restart
. –
Immaculate © 2022 - 2024 — McMap. All rights reserved.