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. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org