node server using 80% CPU

145 views
Skip to first unread message

Reza Razavipour

unread,
May 29, 2014, 12:15:44 AM5/29/14
to nod...@googlegroups.com
I have a RESTful node server. Clients send requests which all translate to SOAP calls. The SOAP server and node server all both on the same machines.
One HTTPS request, all are HTTPS, can translate into up to 7 SOAP calls. 

When the client puts the auto refresh on, every 5 seconds a series of requests are sent to the node server. With 2 clients, auto refresh on, can add up to two dozens of SOAP calls,
the node server, using top, goes up above 80%.

How can I determine what is causing this CPU spike? 2 dozens of SOAP calls can cause this? 


Leo Oshiro

unread,
Jun 4, 2014, 5:45:51 AM6/4/14
to nod...@googlegroups.com
I would recommend profiling the application to find where it spends most of it's time and then debugging, or you could do the later first.

Checkout https://github.com/node-inspector/node-inspector for debugging you app.

For profiling you could use a service like LoopBack or NodeTime, or do it yourself. I personally prefer to run node with --prof and run the v8 profiler on the resulting fille (https://code.google.com/p/v8/wiki/V8Profiler).

Floby

unread,
Jun 5, 2014, 4:17:59 AM6/5/14
to nod...@googlegroups.com
As said before, profiling is probably the way to go here. Good tools have been given. I personally prefer node --prof and inspect the results with v8profiler or https://www.npmjs.org/package/node-tick-processor
If you need finer grain on when you want to profile (for example, a single request) you can use https://www.npmjs.org/package/profiler

My guess, given an ecosystem of HTTPS and SOAP is that a lot of time is spent establishing secure sessions and parsing/serializing XML documents.

Of course, if your architecture allows it, move away from SOAP ;) you'd get caching for free in the protocol.
Reply all
Reply to author
Forward
0 new messages