Sha256: c121719f5dee148f24d7fa4daf97e43c581ae7c69300b1930a1890b15c583496

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

'use strict';
var common = require('../common.js');
var PORT = common.PORT;

var cluster = require('cluster');
if (cluster.isMaster) {
  var bench = common.createBenchmark(main, {
    // unicode confuses ab on os x.
    type: ['bytes', 'buffer'],
    length: [4, 1024, 102400],
    c: [50, 500]
  });
} else {
  require('../http_simple.js');
}

function main(conf) {
  process.env.PORT = PORT;
  var workers = 0;
  var w1 = cluster.fork();
  var w2 = cluster.fork();

  cluster.on('listening', function() {
    workers++;
    if (workers < 2)
      return;

    setTimeout(function() {
      var path = '/' + conf.type + '/' + conf.length;
      var args = ['-d', '10s', '-t', 8, '-c', conf.c];

      bench.http(path, args, function() {
        w1.destroy();
        w2.destroy();
      });
    }, 100);
  });
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
node-compiler-0.7.0 vendor/node-v6.9.1/benchmark/http/cluster.js