Increasing memory without stopping with the main Sails application

To be short, I did not configure the frontend sails project with the base controller and hit it with loadtest, the memory continues to grow and there are no signs of stabilization. I read the previous posts and disabled grunt, session, socket, pubsub etc.

Setup:

Sails Version: v0.12.3

Node version: v4.4.7

NPM Version: v2.15.8

Play:

create a new sail project

sails new Project --no-frontend 

change .sailsrc:

 { "generators": { "modules": {} }, "hooks": { "session": false, "sockets": false, "pubsub": false, "grunt": false, "i18n": false } } 

added controllers /TestController.js:

 module.exports = { hi: function (req, res) { return res.send("Hi there!"); } }; 

perform load check:

 var loadtest = require('loadtest'); var host = 'http://localhost:1337'; var options = { url: host + '/test/hi', requestsPerSecond: 50 }; loadtest.loadTest(options, function(error, result) { if (error) { return console.error('Got an error: %s', error); } console.log('Tests run successfully: '+result); }); 

Thank you for your help.

Mars

+6
source share
3 answers

I know that this will most likely get a vote for not being a concrete answer or throwing links, but this topic has been touched upon by Mike several times through github issues. Since there are so many variables to take into account, he prepared a troubleshooting guide which, although I could copy and paste here, I donโ€™t think itโ€™s good to use any time. So here is the link: https://github.com/balderdashy/sails/issues/2779#issuecomment-209735285

Mike specifically mentions a question about a problem in the project if you feel that there is a real leak that is not included in the troubleshooting guide. I think that you will only get typical stack recommendations, so for me I think you better place your path to github if your problem is not fixed.

+3
source
  • Take a few heap heaps before, during, and after the boot test.
  • Learn Chrome dev tools by downloading a heap dump
  • Report a leak!

https://github.com/bnoordhuis/node-heapdump

Alternatively, you can try to force the GC to run every 60 seconds or something manually by setting a timeout to see if memory crashes after the GC (which means there is no leak).

node --expose-gc script.js

And then from inside Javascript just do:

 setTimeout(function(){ global.gc(); },60000); 
+3
source

I still can not understand what is happening with sails.js after an investigation for a month. I end up rewriting everything with a basic express structure, and I'm glad I did it.

0
source

All Articles