[英]Nodejs High CPU usage
I am trying to determine why my nodejs server has extremely high CPU usage.我试图确定为什么我的 nodejs 服务器具有极高的 CPU 使用率。 When running top, I can see that the CPU usage for node can hit up to 60% with a single user.
在运行 top 时,我可以看到单个用户的节点 CPU 使用率可以达到 60%。 I used node-tick to profile my application, but I cannot seem to understand the results well enough to find the source of the problem.
我使用 node-tick 来分析我的应用程序,但我似乎无法很好地理解结果以找到问题的根源。
I am using:我在用:
socket.io
mongodb
jade-templating
express
Here are the results:结果如下:
[Shared libraries]:
ticks total nonlib name
31273 88.5% 0.0% b77b7000-b77b8000
2144 6.1% 0.0% /usr/local/bin/node
269 0.8% 0.0% /lib/i386-linux-gnu/libc-2.15.so
45 0.1% 0.0% /lib/i386-linux-gnu/libpthread-2.15.so
13 0.0% 0.0% 2cd46000-2cd47000
11 0.0% 0.0% /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
2 0.0% 0.0% /lib/i386-linux-gnu/librt-2.15.so
I cannot seem to find this "b77b7000-b77b8000" and google is not yielding many results.我似乎找不到这个“b77b7000-b77b8000”,而且谷歌没有产生很多结果。
Can anyone determine what is causing my node.js to use so much CPU time?谁能确定是什么导致我的 node.js 使用了如此多的 CPU 时间?
Yo can use a profiler to inspect performance of stack function by function.In my option Chrome's is the best one.您可以使用分析器逐个检查堆栈函数的性能。在我的选项中,Chrome 是最好的。 Here is a tutorial about how to use it with nodejs
这是一个关于如何将它与 nodejs 一起使用的教程
Once you connected debug console to your Chrome debugger you can use performance tab to record a profile for inspection将调试控制台连接到 Chrome 调试器后,您可以使用性能选项卡记录配置文件以供检查
What about the physical memory usage???物理内存使用情况如何??? Is it normal??
正常吗??
I had the same problem.我有同样的问题。 In my case, CPU and physical memory usage were high.
就我而言,CPU 和物理内存使用率很高。 I was trying to bulk insert huge amount of data into the mongo db.
我试图将大量数据批量插入 mongo db。
I removed for loops from my code.我从我的代码中删除了 for 循环。 Then I found a drastic change in the CPU and memory usage.
然后我发现 CPU 和内存使用情况发生了巨大变化。 They got reduced to normal rate.
他们降到了正常的速度。 For loops increases RAM and CPU usage.
For 循环会增加 RAM 和 CPU 使用率。 It keeps on growing.
它继续增长。 Like this, Is there anything in your code that uses large amount of memory and cpu??
像这样,您的代码中是否有任何使用大量内存和 cpu 的内容?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.