【问题标题】:Passenger + Nginx + Node (Meteor) 100% CPU usage乘客 + Nginx + 节点 (Meteor) 100% CPU 使用率
【发布时间】:2017-08-11 01:18:32
【问题描述】:

我在 Ubuntu 16.04.1 LTS(GNU/Linux 4.4.0-62-generic x86_64)下的 AWS EC2 实例上部署了一个使用 Passenger + Nginx(follow)的 Meteor 应用程序

问题在于它会永久占用大约 100% 的 CPU 使用率。

我尝试切换到更强大的实例,甚至部署了一个空白应用程序而不是我的应用程序 - 还是一样。

任何想法在哪里挖掘? 谢谢。

附言

var/log/nginx/error.log:

2017/02/08 08:04:20 [info] 18232#18232: 在 /etc/nginx/nginx.conf:71 中为 nchan 使用 32768KiB 共享内存 [ 2017-02-08 08:04:20.4123 18239/7fe378ac0780 age/Wat/WatchdogMain.cpp:1281 ]:启动乘客看门狗... [ 2017-02-08 08:04:20.4281 18242/7f7adea7b780 age/Cor/CoreMain.cpp:1070 ]:启动乘客核心... [ 2017-02-08 08:04:20.4282 18242/7f7adea7b780 age/Cor/CoreMain.cpp:245 ]:以多应用程序模式运行的乘客核心。 [ 2017-02-08 08:04:20.4309 18242/7f7adea7b780 age/Cor/CoreMain.cpp:820 ]:乘客核心在线,PID 18242 [ 2017-02-08 08:04:20.4511 18248/7fdc44af6780 年龄/Ust/UstRouterMain.cpp:529 ]:启动乘客 UstRouter... [ 2017-02-08 08:04:20.4517 18248/7fdc44af6780 年龄/Ust/UstRouterMain.cpp:342 ]:乘客 UstRouter 在线,PID 18248 [ 2017-02-08 08:04:22.7236 18242/7f7ade98c700 age/Cor/SecurityUpdateChecker.h:464 ]:安全更新检查:未找到更新(24 小时后检查)

npm 安装输出:

> fiber@1.0.15 安装 /var/www/play/bundle/programs/server/node_modules/fibers > 节点构建.js || nodejs build.js `linux-x64-48` 存在;测试 二进制很好;退出 > meteor-dev-bundle@0.0.0 安装 /var/www/play/bundle/programs/server > 节点 npm-rebuild.js { “流星开发包”:“0.0.0”, “npm”:“3.10.10”, “战神”:“1.10.1-DEV”, "http_parser": "2.7.0", “icu”:“56.1”, “模块”:“48”, “节点”:“6.9.5”, “openssl”:“1.0.2k”, “紫外线”:“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 ├── 纤维@1.0.15 ├──meteor-promise@0.8.0 ├─┬ node-gyp@3.4.0 │ ├─┬ fstream@1.0.10 │ │ └── 继承@2.0.3 │ ├─┬ glob@7.1.1 │ │ ├── fs.realpath@1.0.0 │ │ ├─┬ inflight@1.0.6 │ │ │ └── wrappy@1.0.2 │ │ ├── 一次@1.4.0 │ │ └── path-is-absolute@1.0.1 │ ├── 优雅-fs@4.1.11 │ ├─┬ minimatch@3.0.3 │ │ └─┬ 大括号展开@1.1.6 │ │ ├── balance-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 │ │ │ └── 可读流@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 │ │ ├─┬ combine-stream@1.0.5 │ │ │ └── 延迟流@1.0.0 │ │ ├── extend@3.0.0 │ │ ├── 永远代理@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 │ │ │ │ └── 支持-color@2.0.0 │ │ │ ├─┬ 指挥官@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-cmets@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 │ ├── 一次@1.3.3 │ ├─┬ 可读流@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 ├── 承诺@7.1.1 ├── semver@4.1.0 ├── source-map@0.1.32 ├── source-map-support@0.3.2 └──下划线@1.5.2 npm WARN meteor-dev-bundle@0.0.0 无描述 npm WARN meteor-dev-bundle@0.0.0 没有存储库字段。 npm WARN meteor-dev-bundle@0.0.0 没有许可证字段。

【问题讨论】:

  • 你可以通过 ssh 进入盒子,然后运行 ​​top 命令来查看哪个进程占用了所有的 cpu
  • 它是“乘客节点A”。 (添加截图)
  • 日志文件中有任何条目可以为您提供线索吗? npm 安装是否正常工作?
  • 添加了 nginx 错误日志和 npm install 输出。顺便说一句,在开发模式下(没有乘客+nginx)一切正常。

标签: node.js meteor nginx passenger cpu-usage


【解决方案1】:

根据Meteor deployment guide,你必须专门使用Node 4.6.2。

根据您使用的 Meteor 版本,您应该安装 使用适当的安装过程的适当版本的节点 适合您的平台。

  • Meteor 1.4.x 的节点 4.6.2
  • Meteor 1.3.x 及更早版本的节点 0.10.43

如果您在部署时使用了不匹配的 Node 版本 应用程序,你会遇到错误!

Passenger docs 还建议使用 4.x 版本的节点。

它适用于 node js v4.8.4。现在 CPU 很少超过 10%。

【讨论】:

  • Meteor 论坛上有人建议我这样做,麻烦又出现了。看起来我的应用程序只需要更强大的实例。无论如何,谢谢)
【解决方案2】:

通过从头开始重新安装所有内容来修复它。还是不知道怎么回事。

【讨论】:

    【解决方案3】:

    再次发生,大约每天一次:

    想知道Passenger + Nginx是否有替代方案?

    【讨论】:

      【解决方案4】:

      上述答案中提到的节点版本非常重要。您可以尝试安装 nginx+ pm2。它就像魅力一样。要了解更多关于 pm2 的信息,我已经在这里回答了。

      How to run built of Meteor's sample app via Node

      【讨论】:

        猜你喜欢
        • 2013-10-28
        • 1970-01-01
        • 2014-08-10
        • 2018-08-21
        • 2017-05-23
        • 1970-01-01
        • 1970-01-01
        • 2017-08-25
        • 1970-01-01
        相关资源
        最近更新 更多