2016-02-20 02:03:16 +01:00
|
|
|
'use strict';
|
2013-02-12 08:43:22 +01:00
|
|
|
var common = require('../common.js');
|
|
|
|
var PORT = common.PORT;
|
|
|
|
|
|
|
|
var bench = common.createBenchmark(main, {
|
|
|
|
// unicode confuses ab on os x.
|
|
|
|
type: ['bytes', 'buffer'],
|
|
|
|
length: [4, 1024, 102400],
|
2013-11-01 15:44:43 +01:00
|
|
|
chunks: [0, 1, 4], // chunks=0 means 'no chunked encoding'.
|
2013-02-13 21:20:36 +01:00
|
|
|
c: [50, 500]
|
2013-02-12 08:43:22 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
function main(conf) {
|
|
|
|
process.env.PORT = PORT;
|
2016-01-30 14:07:45 +01:00
|
|
|
var server = require('./_http_simple.js');
|
2013-02-12 08:43:22 +01:00
|
|
|
setTimeout(function() {
|
2013-11-01 15:44:43 +01:00
|
|
|
var path = '/' + conf.type + '/' + conf.length + '/' + conf.chunks;
|
2013-02-12 08:43:22 +01:00
|
|
|
|
2016-08-05 11:34:50 +02:00
|
|
|
bench.http({
|
|
|
|
path: path,
|
|
|
|
connections: conf.c
|
|
|
|
}, function() {
|
2013-02-25 17:30:05 +01:00
|
|
|
server.close();
|
2013-02-12 08:43:22 +01:00
|
|
|
});
|
|
|
|
}, 2000);
|
|
|
|
}
|