Search code examples
javaclojurehttp-kit

Max concurrent http requests in http-kit's client?


I'm using http-kit's client, with asynchronous callbacks.

I wanted to know if there's a way to set a limit on the number of concurrent outgoing http requests, so that the waiting state for the callbacks doesn't cause an Out-Of-Memory exception.

I'm asking because, at least in theory, there might be too many concurrent, incompleted requests, that consume memory. Since memory is a limited resource (think about running in a container such as Docker), this might be an issue.

I know that increasing the available RAM is an option, but I'd like to know if there's a relevant limit that can be set.


Solution

  • There is none right now. Given that you want to use it in an async way, I don't think you are going to be able to use any lib and you will need to roll your own. Probably you can take inspiration on Throttler or similar.