Reputation: 4137
I am trying to determine why my nodejs server has extremely high CPU usage. When running top, I can see that the CPU usage for node can hit up to 60% with a single user. 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.
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.
Can anyone determine what is causing my node.js to use so much CPU time?
Upvotes: 4
Views: 10529
Reputation: 425
Yo can use a profiler to inspect performance of stack function by function.In my option Chrome's is the best one. Here is a tutorial about how to use it with nodejs
Once you connected debug console to your Chrome debugger you can use performance tab to record a profile for inspection
Upvotes: 2
Reputation: 210
What about the physical memory usage??? Is it normal??
I had the same problem. In my case, CPU and physical memory usage were high. I was trying to bulk insert huge amount of data into the mongo db.
I removed for loops from my code. Then I found a drastic change in the CPU and memory usage. They got reduced to normal rate. For loops increases RAM and CPU usage. It keeps on growing. Like this, Is there anything in your code that uses large amount of memory and cpu??
Upvotes: 0