javascript - Get requests per second from node.js http server -
is there way in node.js
number of open connections , number of requests per second http server?
assume following simple server:
http.createserver(function (req, res) { res.writehead(200, {'content-type': 'text/plain'}); res.end("hello world!"); }).listen(80);
thanks.
this when want double-check numbers ab/httperf/wrk/siege report:
var served = 0; var concurrent = 0; http.createserver(function (req, res) { concurrent++; res.writehead(200, {'content-type': 'text/plain'}); settimeout(function() { // emulate 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);
Comments
Post a Comment