On Wed, May 29, 2013 at 1:29 PM, Mariusz Nowak <[email protected]> wrote:
> It looks that the more memory is taken by the 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(process.memoryUsage());
>   qs.parse(data);
> };
>
> See this simplified log from my app (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 I send similar POST request, it takes around 30s for
> server process to parse it, that's really bad.
>
> I've checked v0.8.23 and it's affected 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 makes possible to have performant app on a
> server.
> Both v0.10 and v0.11 use exactly same querystring, so it can't be the case
> that querystring became more performant.
>
> My question is, are you (Node.js maintainers) aware of such issue? Do you
> know what's the cause? Is it in V8 or rather some Node.js layer?
>
> Is there a plan to fix it for v0.10 or  it will stay with v0.10, but will be
> fixed with stable. v0.12 release?
>
> Thanks!
> Mariusz Nowak

Without a complete test case I can only guess what's going on.  It's
possible you're hitting a regression in how V8 deals with large UTF-8
encoded strings.

On Linux, run `perf record -c 25000 -e cycles:u -i node script.js`
with v0.10 and v0.11 and compare the generated perf.data with `perf
report` and/or `perf diff`.  Increase -c if perf complains about
dropped events a lot.

-- 
-- 
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