Open stefan-guggisberg opened 4 years ago
Are there any solution to fix this ?
same issue here! any known solution..?
@0xmaayan Have you tried https://github.com/adobe/fetch ?
import { fetch, reset } from '@adobe/fetch';
const main = async () => {
const args = process.argv.slice(2);
const N = args.length && !isNaN(parseInt(args[0])) ? parseInt(args[0]) : 100;
console.log(`running ${N} paralled requests...`)
const TEST_URL = 'https://httpbin.org/bytes/'; // HTTP2
// generete array of 'randomized' urls
const urls = Array.from({ length: N }, () => Math.floor(Math.random() * N)).map((num) => `${TEST_URL}${num}`);
const ts0 = Date.now();
// send requests
const responses = await Promise.all(urls.map((url) => fetch(url)));
// read bodies
await Promise.all(responses.map((resp) => resp.arrayBuffer()));
const ok = responses.filter((res) => res.ok);
if (ok.length !== N) {
console.log(`failed requests: ${N - ok.length}`);
}
const ts1 = Date.now();
console.log(`Elapsed time: ${ts1 - ts0} ms`);
}
main()
.catch(console.error)
.finally(reset);
Running many (e.g. 1000) parallel requests to the same http2 origin causes:
To reproduce:
Run
node test.js 1000
test.js