Skip to content

Instantly share code, notes, and snippets.

@mgunneras
Created July 26, 2010 21:37
Show Gist options
  • Save mgunneras/491295 to your computer and use it in GitHub Desktop.
Save mgunneras/491295 to your computer and use it in GitHub Desktop.
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