100% CPU Usage issues

84 views
Skip to first unread message

Alex Spencer

unread,
Nov 18, 2014, 12:08:34 PM11/18/14
to nod...@googlegroups.com
Hi.

Been having 100% CPU usage issues the past few days and I'm not able to figure out the cause. The setup is postgres for database, express for framework, and knexjs as the database wrapper.

Every request received does issue a lot of database queries, which honestly I wouldn't personally think should cause this kind of issues im seeing.

I've profiled the application using Nodetime just to see if I could figure it out, and from what Nodetime tells me, ~40% is due to Bluebird promises used by knexjs. Has anyone ever seen this kind of issue before relating to promises?

When I handle anywhere between 1-3 requests at the same time, this isn't an issue, but if I were to spam requests (or a lot of clients at the same time) then the server would peak up to 100% CPU usage in no time.

The server isn't great, only running 2gb ram and some half-gitted processor, but running the same application locally (with much better processor & ram) causes the same results, just takes a few more requests.

Joran Dirk Greef

unread,
Nov 19, 2014, 5:28:53 AM11/19/14
to nod...@googlegroups.com
Hi Alex

I would guess the 100% CPU usage is from GC.

If nothing else works, you might want to try recompiling Node after making a small change to heap.cc in node/deps/v8/src/heap.cc using this attachment and see if it helps. I've been running that in production for 2 years now and it drastically reduces unnecessary GC.


Joran
heap.cc
Reply all
Reply to author
Forward
0 new messages