如何调试引起100%cpu使用率的node.js? [英] how to debug node.js causing 100% cpu usage?

查看:193
本文介绍了如何调试引起100%cpu使用率的node.js?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Express和Redis的节点应用程序。在我们的开发服务器上,使用点节点开始使用100%cpu。该应用程序仍会响应,但是使用100%的顶级报告节点。直到重新启动节点后,CPU才会掉线。

I have a node app that uses express and redis. On our development server, after a bit of use node starts to use 100% cpu. The application still responds but top reports node using 100%. The cpu doesn't drop until node is restarted.

我还没有将它固定到任何导致它的特定路由或功能上。

I have not nailed it down to any particular route or function that is causing it.

诊断此问题的最佳方法是什么?

What is the best way to diagnose this problem?

我用v8-profiler查看了节点检查器,它给了我与此处报告的相同错误
https://github.com/dannycoates/v8-profiler/issues/10

I looked at node-inspector with the v8-profiler and it gave me the same error that is reported here https://github.com/dannycoates/v8-profiler/issues/10

推荐答案

您可以使用 node-tick配置应用程序


  1. 通过 node-tick > sudo npm -g install tick

  2. 使用启用的配置文件 node --prof ./app.js

  3. 使用CPU 100%使用一段时间后,停止应用程序

  4. 您可以在应用程序目录中看到v8.log,现在您可以用node-tick-processor读取它

  5. 运行 node-tick-processor 并解释结果

  6. 将v8.log加载到chrome:// tracing中以作为树进行分析。

  1. Install node-tick by sudo npm -g install tick
  2. Run your app with enabled profile node --prof ./app.js
  3. After some time with CPU 100% usage stop your app
  4. You can see v8.log in your app directory, now you can read it with node-tick-processor
  5. Run node-tick-processor and explain results
  6. Load v8.log into chrome://tracing to analyse as tree.

node js cpu 100%

这篇关于如何调试引起100%cpu使用率的node.js?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆