Skip to content

Instantly share code, notes, and snippets.

@itaysk
Created August 3, 2015 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itaysk/11ae6a47d9d159665c05 to your computer and use it in GitHub Desktop.
Save itaysk/11ae6a47d9d159665c05 to your computer and use it in GitHub Desktop.
Test load balancer
var request = require('request');
var a=0 ,b = 0, c=0;
var count=100;
for (var i = 0; i < count; i++) {
request('http://23.97.149.255/', function (error, response, body) {
if (!error && response.statusCode == 200) {
if (body == "10.2.0.4\n") {
a++;
}
else if (body == "10.2.0.6\n") {
b++;
}
else {
c++;
}
}
console.log ("a="+a+" b="+b+" c="+c);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment