Jus*_*tin 2 javascript node.js node-http-proxy
是否有一种方式node.js来获得开连接数和每秒请求数从http服务器?
假设以下简单服务器:
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end("Hello World!");
}).listen(80);
Run Code Online (Sandbox Code Playgroud)
谢谢.
当我想仔细检查数字ab/httperf/wrk/siege报告时,我通常会这样做:
var served = 0;
var concurrent = 0;
http.createServer(function (req, res) {
concurrent++;
res.writeHead(200, {'Content-Type': 'text/plain'});
setTimeout(function() { // emulate some async delay
served++;
concurrent--;
res.end("Hello World!");
}, 10);
}).listen(80);
setInterval(function() {
console.log('Requests per second:' + served);
console.log('Concurrent requests:' + concurrent);
served = 0;
}, 1000);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2104 次 |
| 最近记录: |