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'],
|
2017-03-29 17:31:31 +02:00
|
|
|
len: [4, 1024, 102400],
|
2013-11-01 15:44:43 +01:00
|
|
|
chunks: [0, 1, 4], // chunks=0 means 'no chunked encoding'.
|
2016-12-31 21:58:14 +01:00
|
|
|
c: [50, 500],
|
|
|
|
res: ['normal', 'setHeader', 'setHeaderWH']
|
2013-02-12 08:43:22 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
function main(conf) {
|
|
|
|
process.env.PORT = PORT;
|
2017-03-29 17:31:31 +02:00
|
|
|
var server = require('../fixtures/simple-http-server.js')
|
|
|
|
.listen(process.env.PORT || common.PORT)
|
|
|
|
.on('listening', function() {
|
|
|
|
var path = '/' + conf.type + '/' + conf.len + '/' + conf.chunks + '/' +
|
2016-12-31 21:58:14 +01:00
|
|
|
conf.res;
|
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
|
|
|
});
|
2017-03-29 17:31:31 +02:00
|
|
|
});
|
2013-02-12 08:43:22 +01:00
|
|
|
}
|