Is there a limit for concurrent requests for one axios instance?
Asked Answered
R

2

7

So I am a creating an axios instance that connects to some API like this:

const instance = axios.create(...)

I want to know is there a limit to how many concurrent/parallel requests axios would be able to make with that singular instance. Reason for this is because I have a back-end app that receives hundreds of requests a minute and that number will only keep going up so I want to understand how the axios instance behaves under the hood to know if there is anything I need to do to avoid some sort of overload and requests getting dropped, delayed, and/or unfulfilled.

Resoluble answered 28/12, 2020 at 23:6 Comment(2)
hi, interesting, perhaps this might be of interest #60058074Sadirah
@Sadirah I followed the link to the post. And the post took me to a medium article, but that article doesn't answer the question of "What is the maximum amount of requests" but rather "how to set the maximum amount of allowed concurrent requests"Resoluble
R
3

After some research and reading into axios documentation it seems the answer is not dependent on axios itself but rather built in node features like http and Agent. If you've created an axios instance, and are you using keep-alive:true then agent will throttle and choose how it sends out requests. The answer to this stack overflow question goes more in depth on this.

Concurrent Requests In Node

Resoluble answered 20/7, 2021 at 20:56 Comment(0)
R
-1

https://github.com/bernawil/axios-concurrency/blob/master/index.js

maybe try this, Axios Concurrency Manager Get control of concurrent requests of any axios instance. Implemented using axios interceptors

Rociorock answered 22/8, 2024 at 18:24 Comment(1)
This doesn't answer the original question, "Is there a limit", this simply says that you can set a limit.Resoluble

© 2022 - 2025 — McMap. All rights reserved.