Thursday, 30 November 2017

Should I be looking for a memory leak?

I have a node web app hosted on a 1GB Linode VPS.Node (with express) is mostly used to serve json data. Some of the data is retrieved from another service through an API. The relevant part of the code checks if the data is stored in redis, if not then it makes an API call to the other service to retrieve them, processes the data a bit (nothing too intensive), saves them on redis and then responds.I also cache the responses with Nginx (which sits in front of Node) and with Cloudflare. The total number of requests for these data is about 120 per minute, but most of that is handled by Cloudflare and Nginx and only about 15 requests per minutes reach Node.Node can handle the 15 requests per minute if they are spaced out more or less evenly and the node process uses about 500MB on average. But if say 5-6 requests come at the same second then memory usage goes to about 850MB and PM2 restarts the process.Is that way too much memory use by the node process for so few requests? Should I be looking for memory leaks and/or inefficient code? Or is that within the limits of normal and I should just upgrade my VPS?This if my first node app so I have no point of reference.

Submitted November 30, 2017 at 10:56AM by Ozyzen

No comments:

Post a Comment