[英]Correct usage of PM2 for Node?
I am considering switching from forever to PM2 to keep my node application up and running. 我正在考虑从永远切换到PM2以保持我的节点应用程序正常运行。
I am confused about the following recommended 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? 有人可以向我解释什么是app.js的集群实例? How many instances should I start?
我应该开多少个实例? 1?
1? Max?
马克斯?
Clustered app means duplicating the application to use each cpu instead of only one, 群集应用程序意味着复制应用程序以使用每个cpu而不是只有一个,
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! 它将根据可用的cpu数量启动最大数量的应用程序,因此如果它是一个联网的应用程序,请求将在所有进程之间平衡!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.