-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Node.js memory usage issue #25519
Comments
I would recommend trying io.js 2.x: Aside from that tls bug that was fixed in io.js, the memory (RSS, not heapUsed) not going down is pretty normal for all apps, it is kept by the process and should be re-used instead. |
Thanks. I have tried a simple http server example as - var http = require("http"); http.createServer(function(req,res){ Even this code if pumped with transactions the memory usage goes on increasing. I understand that app Is there any way to know whether the application is reusing the memory? |
What are your exact rss/heapUsed values? I just tested your code sample (using recent io.js, but it should be alike in node 0.12 for such a simple testcase) and performed 100000 requests (10 parallel at each moment). There are at least two moments that you should keep in mind here:
|
Thanks. I am much clear about it. I have tested my code with hitting 1000 requests and concurrency of 10 it works fine but if I increase concurrency to 1000 I see there is a memory leak. I have used memwatch module for tracing it. Output:
|
What's your absolute rss/heapTotal/heapUsed values after those requests? That thing that you are using does not report memory leaks, it reports memory usage growth. It's quite obvious that 1000 parallel requests will increase your memory usage a bit. |
Hello, Following are the values before hitting the 1000 concurrent requests and after all the requests are served: start end Can you then suggest me how to make sure the code is not leaking out anywhere? |
Is that https or http? |
Its https. |
@viddeshshinde The above testcase was http-based. |
The values pasted above are https-based testcase. I am using node v0.10.33. |
Closing as there does not appear to be anything to do here. |
I have created https server using https module. When I hit the server with the requests and run the 'top' command, I can see the memory usage goes on increasing with the subsequent requests. After the server becomes idle the memory usage does't go down, it remains constant as maximum used. If I hit another bunch of transactions again it goes on increasing and stays at same size.
Is this a normal behaviour of Node.js or there is a memory leak issue in my code?
The text was updated successfully, but these errors were encountered: