Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Sandcastle error on loadtest #68

Open
raghuram-periaswamy opened this issue Apr 8, 2016 · 4 comments
Open

Sandcastle error on loadtest #68

raghuram-periaswamy opened this issue Apr 8, 2016 · 4 comments

Comments

@raghuram-periaswamy
Copy link

We did a load test for 1000 request with 100 as the concurrency level, sandcastle exited with following error:

Error: spawn /usr/local/Cellar/node/5.5.0/bin/node ENFILE
at exports._errnoException (util.js:856:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickDomainCallback (node.js:429:17)

@bcoe
Copy link
Owner

bcoe commented Apr 9, 2016

@raghu12133 it works well with smaller batch sizes? mind sharing a failing script?

@sathishceg
Copy link

@bcoe below is the script which we tested:

var SandCastle = require('sandcastle').SandCastle;
var script_content = fs.readFileSync('path to script to be executed in sandcastle').toString();

//route entry point
app.get("/execute", function(req, res){
  execute_code(req.body.args, function(data){
    res.json({"data": data});
  });
});

var execute_code = function(params, callback){
    var sandcastle = new SandCastle();
    var script = sandcastle.createScript(script_content);
    script.on('timeout', function(methodName) {
      console.log("inside timeout");
      return callback("timeout");
    });
    script.on('exit', function(err, output, methodName) {
     console.log(output);
     return callback(output);
    });
    script.run("fibonacci", {"args": params});
}

//script to be executed in sandcastle
exports = {
  fibonacci: function() {
    var looping = function(n) {
        var a = 0, b = 1, f = 1;
        for(var i = 2; i <= n; i++) {

            f = a + b;
            a = b;
            b = f;
        }
        return f;
    };
    exit(looping(1000));
  }
 }

we used apache benchmark to do the load test for 1000 request with 200 as the concurrency level and faced the above issue..

apache benchmark script:

ab -n 1000 -c 150  -k http://localhost:5000/execute

@sathishceg
Copy link

also there seems to be a memory leak. check the logs:

(node) warning: possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at process.addListener (events.js:239:17)
    at new SandCastle (/Users/user/Documents/projects/node_sample/node_modules/sandcastle/lib/sandcastle.js:45:11)
    at Sandbox.execute (/Users/user/Documents/projects/node_sample/routes/sandbox.js:5:19)
    at execute_server_code (/Users/user/Documents/projects/node_sample/routes/routes.js:123:7)
    at /Users/user/Documents/projects/node_sample/routes/routes.js:78:3
    at Layer.handle [as handle_request] (/Users/user/Documents/projects/node_sample/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/user/Documents/projects/node_sample/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/Users/user/Documents/projects/node_sample/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/user/Documents/projects/node_sample/node_modules/express/lib/router/layer.js:95:5)
    at /Users/user/Documents/projects/node_sample/node_modules/express/lib/router/index.js:277:22

@bcoe
Copy link
Owner

bcoe commented Apr 11, 2016

would love some help digging into this, I'm not currently using SandCastle anywhere in production and would appreciate another set of eyes:

CC: @joernroeder, @alexkwolfe

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants