Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs High CPU usage

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?

like image 778
Franz Payer Avatar asked Apr 29 '26 19:04

Franz Payer


1 Answers

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 inspectionhere is a screenshot

like image 126
Tamer Aktaş Avatar answered May 01 '26 10:05

Tamer Aktaş



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!