Skip to content

Instantly share code, notes, and snippets.

@ericmustin
Created December 28, 2019 12:23
Show Gist options
  • Save ericmustin/d70dfc9fdfb78732302a119793ad7c44 to your computer and use it in GitHub Desktop.
Save ericmustin/d70dfc9fdfb78732302a119793ad7c44 to your computer and use it in GitHub Desktop.
concurrent requests test script
var http = require('http');
var results = [];
var j=0;
// Make 50 parallel requests:
for (i=0;i<50;i++) {
http.request({
host:'127.0.0.1',
port: 3000,
path:'/orm/show?todoId=1'
},function(res){
results.push(res.statusCode);
j++;
if (j==i) { // last request
console.log(JSON.stringify(results));
}
}).end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment