| npm |
http-connection-pool quickly performs many HTTP requests in concurrently that cannot be processed at once.
npm install http-connection-pool
const { ConnectionPool } = require("http-connection-pool");
const connectionPool = new ConnectionPool({size: 1000});
for (let i = 0; i <= 100_000; i++) {
connectionPool.add({
url: "http://localhost:3000/get"
})
.then(d => {
console.log(d)
})
.catch(e => {
console.log(e)
})
}
import ConnectionPool from "http-connection-pool";
const connectionPool = new ConnectionPool({size: 1000});
for (let i = 0; i <= 100_000; i++) {
connectionPool.add({
url: "http://localhost:3000/get"
})
.then(d => {
console.log(d)
})
.catch(e => {
console.log(e)
})
}
import ConnectionPool from "http-connection-pool";
const connectionPool = new ConnectionPool({size: 1000});
for (let i = 0; i <= 100_000; i++) {
connectionPool.add({
url: "http://localhost:3000/get"
})
.then(d => {
console.log(d)
})
.catch(e => {
console.log(e)
})
}
import ConnectionPool from "http-connection-pool";
import axios, { AxiosResponse } from "axios";
const connectionPool = new ConnectionPool({size: 1000});
for (let i = 0; i <= 100_000; i++) {
connectionPool.addExternalHttpClient<AxiosResponse>(axios.get, `http://localhost:${PORT}/test`)
.then(d => console.log(d.data, i));
}
import ConnectionPool from 'http-connection-pool';
import fetch, {Response} from "node-fetch";
const connectionPool = new ConnectionPool({size: 1000});
for (let i = 0; i <= 100_000; i++) {
connectionPool.addExternalHttpClient<Response>(fetch, `http://localhost:${PORT}/test`)
.then(d => d.text())
.then(d => console.log(d, i));
}