简体   繁体   English

乘客+Nginx+节点(流星)CPU使用率100%

[英]Passenger + Nginx + Node (Meteor) 100% CPU usage

I have a Meteor app deployed with Passenger + Nginx (as follow ) on AWS EC2 instance under Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-62-generic x86_64)我在 Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-62-generic x86_64) 下的 AWS EC2 实例上部署了一个使用Passenger + Nginx( 如下)的Meteor 应用程序

The problem is that it takes around 100% CPU usage permanently.问题是它永久占用了大约 100% 的 CPU 使用率。

在此处输入图片说明

I've tried to switch to more powerful instance and even deployed a blank app instead of mine - still the same.我尝试切换到更强大的实例,甚至部署了一个空白应用程序而不是我的 - 仍然相同。

Any ideas where to dig?任何想法在哪里挖掘? Thanks.谢谢。

PS聚苯乙烯

var/log/nginx/error.log: var/log/nginx/error.log:

2017/02/08 08:04:20 [info] 18232#18232: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:71
[ 2017-02-08 08:04:20.4123 18239/7fe378ac0780 age/Wat/WatchdogMain.cpp:1281 ]: Starting Passenger watchdog...
[ 2017-02-08 08:04:20.4281 18242/7f7adea7b780 age/Cor/CoreMain.cpp:1070 ]: Starting Passenger core...
[ 2017-02-08 08:04:20.4282 18242/7f7adea7b780 age/Cor/CoreMain.cpp:245 ]: Passenger core running in multi-application mode.
[ 2017-02-08 08:04:20.4309 18242/7f7adea7b780 age/Cor/CoreMain.cpp:820 ]: Passenger core online, PID 18242
[ 2017-02-08 08:04:20.4511 18248/7fdc44af6780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2017-02-08 08:04:20.4517 18248/7fdc44af6780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 18248
[ 2017-02-08 08:04:22.7236 18242/7f7ade98c700 age/Cor/SecurityUpdateChecker.h:464 ]: Security update check: no update found (next check in 24 hours)

npm install output: npm 安装输出:

> fibers@1.0.15 install /var/www/play/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js

`linux-x64-48` exists; testing
Binary is fine; exiting

> meteor-dev-bundle@0.0.0 install /var/www/play/bundle/programs/server
> node npm-rebuild.js

{
  "meteor-dev-bundle": "0.0.0",
  "npm": "3.10.10",
  "ares": "1.10.1-DEV",
  "http_parser": "2.7.0",
  "icu": "56.1",
  "modules": "48",
  "node": "6.9.5",
  "openssl": "1.0.2k",
  "uv": "1.9.1",
  "v8": "5.1.281.89",
  "zlib": "1.2.8"
}
meteor-dev-bundle@0.0.0 /var/www/play/bundle/programs/server
├── amdefine@1.0.1
├── asap@2.0.5
├── fibers@1.0.15
├── meteor-promise@0.8.0
├─┬ node-gyp@3.4.0
│ ├─┬ fstream@1.0.10
│ │ └── inherits@2.0.3
│ ├─┬ glob@7.1.1
│ │ ├── fs.realpath@1.0.0
│ │ ├─┬ inflight@1.0.6
│ │ │ └── wrappy@1.0.2
│ │ ├── once@1.4.0
│ │ └── path-is-absolute@1.0.1
│ ├── graceful-fs@4.1.11
│ ├─┬ minimatch@3.0.3
│ │ └─┬ brace-expansion@1.1.6
│ │   ├── balanced-match@0.4.2
│ │   └── concat-map@0.0.1
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├─┬ nopt@3.0.6
│ │ └── abbrev@1.0.9
│ ├─┬ npmlog@3.1.2
│ │ ├─┬ are-we-there-yet@1.1.2
│ │ │ ├── delegates@1.0.0
│ │ │ └── readable-stream@2.2.2
│ │ ├── console-control-strings@1.1.0
│ │ ├─┬ gauge@2.6.0
│ │ │ ├── aproba@1.1.0
│ │ │ ├── has-color@0.1.7
│ │ │ ├── has-unicode@2.0.1
│ │ │ ├── object-assign@4.1.1
│ │ │ ├── signal-exit@3.0.2
│ │ │ ├─┬ string-width@1.0.2
│ │ │ │ ├── code-point-at@1.1.0
│ │ │ │ └─┬ is-fullwidth-code-point@1.0.0
│ │ │ │   └── number-is-nan@1.0.1
│ │ │ ├─┬ strip-ansi@3.0.1
│ │ │ │ └── ansi-regex@2.1.1
│ │ │ └── wide-align@1.1.0
│ │ └── set-blocking@2.0.0
│ ├─┬ osenv@0.1.4
│ │ ├── os-homedir@1.0.2
│ │ └── os-tmpdir@1.0.2
│ ├─┬ path-array@1.0.1
│ │ └─┬ array-index@1.0.0
│ │   ├─┬ debug@2.6.0
│ │   │ └── ms@0.7.2
│ │   └─┬ es6-symbol@3.1.0
│ │     ├── d@0.1.1
│ │     └─┬ es5-ext@0.10.12
│ │       └── es6-iterator@2.0.0
│ ├─┬ request@2.79.0
│ │ ├── aws-sign2@0.6.0
│ │ ├── aws4@1.6.0
│ │ ├── caseless@0.11.0
│ │ ├─┬ combined-stream@1.0.5
│ │ │ └── delayed-stream@1.0.0
│ │ ├── extend@3.0.0
│ │ ├── forever-agent@0.6.1
│ │ ├─┬ form-data@2.1.2
│ │ │ └── asynckit@0.4.0
│ │ ├─┬ har-validator@2.0.6
│ │ │ ├─┬ chalk@1.1.3
│ │ │ │ ├── ansi-styles@2.2.1
│ │ │ │ ├── escape-string-regexp@1.0.5
│ │ │ │ ├── has-ansi@2.0.0
│ │ │ │ └── supports-color@2.0.0
│ │ │ ├─┬ commander@2.9.0
│ │ │ │ └── graceful-readlink@1.0.1
│ │ │ ├─┬ is-my-json-valid@2.15.0
│ │ │ │ ├── generate-function@2.0.0
│ │ │ │ ├─┬ generate-object-property@1.2.0
│ │ │ │ │ └── is-property@1.0.2
│ │ │ │ ├── jsonpointer@4.0.1
│ │ │ │ └── xtend@4.0.1
│ │ │ └─┬ pinkie-promise@2.0.1
│ │ │   └── pinkie@2.0.4
│ │ ├─┬ hawk@3.1.3
│ │ │ ├── boom@2.10.1
│ │ │ ├── cryptiles@2.0.5
│ │ │ ├── hoek@2.16.3
│ │ │ └── sntp@1.0.9
│ │ ├─┬ http-signature@1.1.1
│ │ │ ├── assert-plus@0.2.0
│ │ │ ├─┬ jsprim@1.3.1
│ │ │ │ ├── extsprintf@1.0.2
│ │ │ │ ├── json-schema@0.2.3
│ │ │ │ └── verror@1.3.6
│ │ │ └─┬ sshpk@1.10.2
│ │ │   ├── asn1@0.2.3
│ │ │   ├── assert-plus@1.0.0
│ │ │   ├── bcrypt-pbkdf@1.0.1
│ │ │   ├─┬ dashdash@1.14.1
│ │ │   │ └── assert-plus@1.0.0
│ │ │   ├── ecc-jsbn@0.1.1
│ │ │   ├─┬ getpass@0.1.6
│ │ │   │ └── assert-plus@1.0.0
│ │ │   ├── jodid25519@1.0.2
│ │ │   ├── jsbn@0.1.0
│ │ │   └── tweetnacl@0.14.5
│ │ ├── is-typedarray@1.0.0
│ │ ├── isstream@0.1.2
│ │ ├── json-stringify-safe@5.0.1
│ │ ├─┬ mime-types@2.1.14
│ │ │ └── mime-db@1.26.0
│ │ ├── oauth-sign@0.8.2
│ │ ├── qs@6.3.0
│ │ ├── stringstream@0.0.5
│ │ ├─┬ tough-cookie@2.3.2
│ │ │ └── punycode@1.4.1
│ │ ├── tunnel-agent@0.4.3
│ │ └── uuid@3.0.1
│ ├── rimraf@2.5.4
│ ├─┬ tar@2.2.1
│ │ └── block-stream@0.0.9
│ └─┬ which@1.2.12
│   └── isexe@1.1.2
├─┬ node-pre-gyp@0.6.29
│ ├─┬ rc@1.1.6
│ │ ├── deep-extend@0.4.1
│ │ ├── ini@1.3.4
│ │ ├── minimist@1.2.0
│ │ └── strip-json-comments@1.0.4
│ ├── semver@5.2.0
│ └─┬ tar-pack@3.1.4
│   ├─┬ debug@2.2.0
│   │ └── ms@0.7.1
│   ├── fstream-ignore@1.0.5
│   ├── once@1.3.3
│   ├─┬ readable-stream@2.1.5
│   │ ├── buffer-shims@1.0.0
│   │ ├── core-util-is@1.0.2
│   │ ├── isarray@1.0.0
│   │ ├── process-nextick-args@1.0.7
│   │ ├── string_decoder@0.10.31
│   │ └── util-deprecate@1.0.2
│   └── uid-number@0.0.6
├── promise@7.1.1
├── semver@4.1.0
├── source-map@0.1.32
├── source-map-support@0.3.2
└── underscore@1.5.2

npm WARN meteor-dev-bundle@0.0.0 No description
npm WARN meteor-dev-bundle@0.0.0 No repository field.
npm WARN meteor-dev-bundle@0.0.0 No license field.

According to the Meteor deployment guide , you have to use specifically Node 4.6.2.根据Meteor 部署指南,您必须专门使用 Node 4.6.2。

Depending on the version of Meteor you are using, you should install the proper version of node using the appropriate installation process for your platform.根据您使用的 Meteor 版本,您应该使用适合您平台的安装过程来安装正确版本的节点。

  • Node 4.6.2 for Meteor 1.4.x用于 Meteor 1.4.x 的节点 4.6.2
  • Node 0.10.43 for Meteor 1.3.x and earlier用于 Meteor 1.3.x 及更早版本的节点 0.10.43

If you use a mismatched version of Node when deploying your application, you will encounter errors!如果在部署应用程序时使用了不匹配的 Node 版本,则会遇到错误!

Passenger docs also suggest a 4.x version of node. 乘客文档还建议使用 4.x 版本的节点。

It worked for me with node js v4.8.4.它适用于 node js v4.8.4。 Now CPU rarely goes above 10%.现在 CPU 很少超过 10%。

Fixed it by reinstalling everything from the scratch.通过从头开始重新安装所有内容来修复它。 Still don't know what happend.还是不知道怎么回事。

It's happening again, approximately once per day:它再次发生,大约每天一次: 在此处输入图片说明

Wonder if there is some alternative for Passenger + Nginx?想知道Passenger + Nginx 是否有替代品?

Node version as mentioned in above answers strictly matters.上面答案中提到的节点版本非常重要。 You can try installing nginx+ pm2.你可以尝试安装nginx+pm2。 It works like charm.它就像魅力一样。 To know more about pm2 , I already answered here.要了解有关 pm2 的更多信息,我已经在这里回答了。

How to run built of Meteor's sample app via Node 如何通过 Node 运行构建的 Meteor 示例应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM