Actually I'm unable to understand the use of pm2 scale [app-name] 10
but I know pm2 start app.js -i 4
is used for starting instances of app in cluster mode.
And one other question what would happen if I'll set number of clusters as -1 means
pm2 start app.js -i -1
PM2 is able to create new processes or delete currently running ones depending on the number you provide for the scale
option, pm2 scale N
, from the documentation: N is a consistent number which the cluster will scale up or down
.
pm2 scale app +3
- Adds 3 new processes to the current ones running.
pm2 scale app 3
- Sets the number of instances to 3. thanks @Jolly for the correction.
Regarding the -1
in pm2 start app.js -i -1
, it means that PM2 will create a number of new processes that is equal to (Number of Cores)-1
.