does anyone know if it is possible to change in NodeJS PM2 the number of cluster processes for an application at runtime?
regards Philipp
PM2 is a production process manager for Node. js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
PM2 Runtime is a Production Process Manager for Node. js applications with a built-in Load Balancer. It allows you to keep applications alive forever, to reload them without downtime and facilitate common Devops tasks. Starting an application in production mode is as easy as: $ pm2 start app.js.
Take the fork mode as a basic process spawning. This allows to change the exec_interpreter , so that you can run a php or a python server with pm2. Yes, the exec_interpreter is the "command" used to start the child process.
According to the StackShare community, PM2 has a broader approval, being mentioned in 74 company stacks & 107 developers stacks; compared to forever, which is listed in 3 company stacks and 3 developer stacks.
You can use pm2 scale
to scale vertically the number of process at runtime, note that it only work with cluster mode.
Example :
pm2 scale APPNAME 2
will scale the process to exactly 2 instances.pm2 scale APPNAME +2
will add two process.pm2 scale APPNAME -1
will remove one process.source link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With