It looks that the more memory is taken by node process, the more 
performance of CPU intensive tasks drops.  I've discovered that seeing 
really bad performance of parsing body post request by my app server. It 
takes 30s with my v0.10 Node server, but when I put same body content to 
parse in simple plain script it takes around 60ms.

To look at it closer I prepared a simple CPU intensive function, that 
resembled bottleneck operation on my side:

var qs = require('querystring');
var data = "...130k long POST request body ...";

module.exports = function parseTest() {
  console.log("Memory usage:", process.memoryUsage());
  var time = Date.now();
  qs.parse(data);
  console.log("Parse test:", (Date.now() - time) + "ms");
};

..and run it at various moments in my app. See this simplified log (running 
v0.10.8 on OSX, but I can confirm similar behavior on Ubuntu box)

.. Process start ..
Memory usage: { rss: 29274112, heapTotal: 26003712, heapUsed: 9881912 }
Parse test: 74ms

... Load schemas ...
Memory usage: { rss: 133754880, heapTotal: 119911424, heapUsed: 88224088 }
Parse test: 967ms

... Load (other) schemas ...
Memory usage: { rss: 438939648, heapTotal: 412051624, heapUsed: 388808776 }
Parse test: 8127ms

... Populate database ... .
Memory usage: { rss: 573509632, heapTotal: 543040880, heapUsed: 516926304 }
Parse test: 24704ms

... Start server ...
Memory usage: { rss: 485855232, heapTotal: 458623864, heapUsed: 416212096 }
Parse test: 26004ms

Then at any point similar POST request is processed, it takes around 30s 
for server process to parse it, that's really bad.

I've checked v0.8.23 and it's affected in same way, but I was very happy to 
find that v0.11.2 doesn't have that issue.

Log when running same app on same machine but with v0.11.2:

.. Process start ..
Memory usage: { rss: 28647424, heapTotal: 25991680, heapUsed: 9322968 }
Parse test: 8ms

... Load schemas ...
Memory usage: { rss: 127152128, heapTotal: 112784128, heapUsed: 53569168 }
Parse test: 5ms

... Load (other) schemas ...
Memory usage: { rss: 531435520, heapTotal: 501778432, heapUsed: 430137928 }
Parse test: 5ms

... Populate database ... .
Memory usage: { rss: 716591104, heapTotal: 682931712, heapUsed: 448264624 }
Parse test: 3ms

... Start server ...
Memory usage: { rss: 716627968, heapTotal: 682931712, heapUsed: 449970104 }
Parse test: 2ms

That makes huge difference, and v0.11 luckily makes possible for me to have 
performant node app on a server.

Both v0.10 and v0.11 use exactly same querystring module, so it can't be 
the case that parse function is faster in v0.11.

My question is, are you aware of such issue? Do you know what's the cause? 
Is it issue of V8 or rather some Node.js layer?

Is there a plan to fix it in v0.10, or  it will stay with v0.10, but will 
be fixed with stable. v0.12 release?

Thanks!
Mariusz Nowak

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to