Skip to content

Instantly share code, notes, and snippets.

@Jarred-Sumner
Created September 17, 2022 06:40
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 Jarred-Sumner/d1cd803fc33023a4dfa557357613ac84 to your computer and use it in GitHub Desktop.
Save Jarred-Sumner/d1cd803fc33023a4dfa557357613ac84 to your computer and use it in GitHub Desktop.
const options = {
keepalive: true,
};
var i = 0;
var lastSecond = 0;
function dump() {
if (lastSecond > 0) console.log(i - lastSecond, "req/s");
lastSecond = i;
}
setInterval(dump, 1000);
const url = "http://localhost:3000/";
while (true) {
try {
const array = [
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
fetch(url, options),
];
await Promise.all(array);
i += array.length;
} catch (e) {
console.error(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment