Created
December 28, 2019 12:23
-
-
Save ericmustin/d70dfc9fdfb78732302a119793ad7c44 to your computer and use it in GitHub Desktop.
concurrent requests test script
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'); | |
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