I have similar problems right now. We switched from node 0.8.25 to 0.10.12
and now servers consuming lots of memory. I could track this down db calls
using mongoose. Every time I call some url, memory usage increases 0.5-1 Mb
and remains on this level. The same happens on node 0.8.25, but the memory
usage goes very quickly down, within seconds. After I pumped the memory on
node 0.10.12 full, I was waiting about 30-60 minutes - and then it was
near the start position again.
It looks for me like the reason is not the js code itself leaking
variables, because it should never go down in this case, but it looks like
gc is not doing his work as usual.
Its an urgent problem for me right now, any suggestions what to try would
be helpfull.
Best,
Oleg
On Tuesday, June 25, 2013 3:39:56 PM UTC+2, alessioalex wrote:
>
> Hello there,
>
> I'm monitoring my app and I've seen my memory usage increase really oddly
> (it did not decrease after X hours), so I suspected a leak. I've found out
> that the memory seems to remain uncollected when using fs.readStream. I
> made a small example with an http server that serving a 2mb file and did
> some ab (apache benchmark) load testing on it (ab -n 5000 -c 100 a couple
> of times). X minutes after the load testing is done, the memory idles at
> 480 Mb and doesn't drop.
>
> Am I missing something or is there really a problem with this?
>
> index.js
>
> var http = require('http'),
> bytes = require('bytes'), // npm install bytes
> fs = require('fs');
>
>
>
> var fpath = '/path/to/a/2mb/file/in/my/case';
>
>
> http.createServer(function(req, res) {
>
> fs.createReadStream(fpath).pipe(res);
>
> }).listen(7777);
>
>
>
> var lastMem;
>
>
>
> function getMem(msg) {
>
> var memUsg;
>
>
>
> msg = msg || '';
>
>
>
> memUsg = bytes(process.memoryUsage().rss);
>
> if (lastMem !== memUsg) {
>
> lastMem = memUsg;
>
> console.log(msg + ' ' + memUsg);
>
> }
>
> }
>
>
>
> setInterval(function() {
>
> getMem('rss:');
>
> }, 5000);
>
> Thanks!
>
--
--
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.