hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Bounding the number of outstanding requests with the reactor
Date Wed, 30 Dec 2015 09:11:45 GMT
On Tue, 2015-12-29 at 13:44 -0500, Benson Margulies wrote:
> I have an application that needs to send many http requests. However,
> I would like to bound the maximum number of outstanding requests.
> The reason is that the requests are being sent to a service that is
> running in an AWS autoscaled environment. When there is a large
> increase in load, the environment will start additional instances. So,
> I would prefer that a sudden spike in demand remains queued in my
> application and not be turned into pending requests.
> https://hc.apache.org/httpcomponents-core-ga/httpcore-nio/apidocs/org/apache/http/impl/nio/reactor/IOReactorConfig.Builder.html
> does not seem to have a parameter that would correspond to such a
> limit. I could implement this for myself by having a queue, and a
> thread that just sat pushing requests from the queue into the reactor,
> and stopped when it reached my limit of outstanding requests.
> Is my analysis plausible?

Absolutely. The internal request queue of HttpAsyncClient is unbounded.
Maintaining a bounded queue with desired characteristics and a dedicated
consumer thread sounds like the best option for your particular case.


To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message