LearnBoost / up

Zero-downtime reloads and requests load balancer based on distribute.
540 stars 73 forks source link

Do not use up with node v0.10.0 (v0.10+?) #65

Open cmawhorter opened 11 years ago

cmawhorter commented 11 years ago

If up becomes saturated with (very) minimal traffic, the server will become unresponsive to requests and memory usage will skyrocket along with CPU.

I only tested locally, so it's possible it might just be me, but I doubt it.

You may see this message:

(libuv) Failed to create kqueue (24)

index.js

process.title = 'up-test';

var up = require('up')
    , server = require('http').Server().listen(3100);

var srv = up(server, __dirname + '/blah.js', {
        numWorkers: 4
});

blah.js

process.title = 'up-test-worker';

var http = require('http');

module.exports = http.Server(function (req, res) {
  res.writeHead(200);
  res.end('Hello World');
  console.log('connection...' + new Date());
});

setInterval(function() { console.log(process.pid + ' waiting for conntections...'); }, 5000);

Use apache's benchmarking tool:

ab -n16 -c8 http://localhost:3100/

c can be anything > numWorkers n should be anything > c

On rare occasions, the above command will succeed without causing errors. Might want to try higher numbers.

I didn't investigate too deeply beyond "oh... up is broken", but I think it has something to do with this: http://stackoverflow.com/a/15537504/670023

I think this was discussed in #62, but I wanted to make something more prominent and supply a test.