Created
July 26, 2010 21:37
-
-
Save mgunneras/491295 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
host = 'aws01', | |
creation_delay = 5, | |
reporting_delay = 3000, | |
clients = [], | |
limit = process.argv[2] || 500, | |
headers = { | |
'Host' : host | |
}; | |
var create_http_client = function () { | |
var client = http.createClient(80, host); | |
client.on('connect', function(){ | |
clients.push(this); | |
if (clients.length < limit) { | |
setTimeout(create_http_client, creation_delay); | |
} | |
}); | |
var request = client.request('GET', '/feed/subscribe', headers); | |
request.end(); | |
}; | |
setInterval(function () { | |
console.log('limit: '+limit+' connected: '+clients.length); | |
}, reporting_delay); | |
create_http_client(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment