diff options
author | isaacs <i@izs.me> | 2012-03-07 06:18:53 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-03-07 06:19:17 +0400 |
commit | 17da4242b0dd8bd45f34d7f1610d83d1036b9e6d (patch) | |
tree | 0d4580e9daa264aaafb5d14f3ca4e2f035dc718c /benchmark | |
parent | d5fca08da45feb6e28c19a0ff2cfd819edf9238c (diff) |
A server with configurable lag for testing
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/http_server_lag.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/benchmark/http_server_lag.js b/benchmark/http_server_lag.js new file mode 100644 index 00000000000..a2028ac9ab0 --- /dev/null +++ b/benchmark/http_server_lag.js @@ -0,0 +1,13 @@ +var http = require('http'); +var port = parseInt(process.env.PORT, 10) || 8000; +var defaultLag = parseInt(process.argv[2], 10) || 100; + +http.createServer(function(req, res) { + res.writeHead(200, { 'content-type': 'text/plain', + 'content-lengt': '2' }); + + var lag = parseInt(req.url.split("/").pop(), 10) || defaultLag; + setTimeout(function() { + res.end('ok'); + }, lag); +}).listen(port, 'localhost'); |