shell> npm install bench-rest
var benchrest = require('bench-rest');
var flow = 'http://localhost:8000/';
var flow = {
main: [
{ post: 'http://localhost:8000/foo', headers: { 'Content-Type': 'application/json'}, body: '' },
{ get: 'http://localhost:8000/foo' }
]
};
var runOptions = {
limit: 10,
iterations: 100
};
benchrest(flow, runOptions)
.on('error', function (err, ctxName) { console.error('Failed in %s with err: ', ctxName, err); })
.on('end', function (stats, errorCount) {
console.log('error count: ', errorCount);
console.log('stats', stats);
});
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
ulimit -n 63536
參考網站: