javascript - Correct usage of PM2 for Node? - Stack Overflow

I am considering switching from forever to PM2 to keep my node application up and running.I am confused

I am considering switching from forever to PM2 to keep my node application up and running.

I am confused about the following remended methods for starting a process:

$ pm2 start app.js -i 4 # Daemonize pm2 and Start 4 clustered instances of app.js
                        # You can also pass the 'max' params to start

Could someone explain to me what is a clustered instance of app.js? How many instances should I start? 1? Max?

I am considering switching from forever to PM2 to keep my node application up and running.

I am confused about the following remended methods for starting a process:

$ pm2 start app.js -i 4 # Daemonize pm2 and Start 4 clustered instances of app.js
                        # You can also pass the 'max' params to start

Could someone explain to me what is a clustered instance of app.js? How many instances should I start? 1? Max?

Share Improve this question edited Jun 17, 2014 at 8:41 Oleg 9,3592 gold badges45 silver badges59 bronze badges asked Sep 19, 2013 at 20:31 user1031947user1031947 6,67417 gold badges65 silver badges91 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

Clustered app means duplicating the application to use each cpu instead of only one,

If you do:

$ pm2 start app.js

It will only launch one application

If you do:

$ pm2 start app.js -i max

It will launch the maximum number applications depending on the number of cpus available, so if it's a networked app, requests will be balanced between all processes!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742294361a4416815.html

相关推荐

  • javascript - Correct usage of PM2 for Node? - Stack Overflow

    I am considering switching from forever to PM2 to keep my node application up and running.I am confused

    18小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信