Hi Oleg!

Thx for the swift reply, turned out very helpful :)

>> Hi everybody,
>>
>> I want to collect (execution) timing probes from various processing
>> stages of a request/response inside an AsyncHttpClient (running HC 5
>> alpha 2 & friends).
>>
>> So far, I rougly implemented sth. sketched out my Oleg in this
>> posting I
>> found when crawling the archive:
>>
>>> In this case you should have a pool of HttpClient instances each
>>> configured to use a small pool of connections (2 to 5). This setup
>>> will
>>> be more representative of thousands of concurrent browser
>>> connections.
>>> With one large pool of connections you basically have 1000 thousand
>>> of
>>> threads constantly contending for one global pool lock. 
>> http://httpcomponents.10934.n7.nabble.com/Scalable-Http-Client-td2071
>> 2.html
>>
> As of 5.0-alpha3 HttpClient also supports so called lax (or concurrent)
> connection pooling which does not involve a global lock. 

Ok, I will check that later.
>
>
>> I have some follow-up questions:
>>
>> 1) How to best emit timing probes (start, end time) for a
>> request/response pair: Setup a pair of correlated request/response
>> interceptors? 
> By using an execution interceptor:
>
> https://github.com/apache/httpcomponents-client/blob/master/httpclient5
> /src/main/java/org/apache/hc/client5/http/async/AsyncExecChainHandler.j
> ava
>
> See these examples
>
> https://github.com/apache/httpcomponents-client/blob/master/httpclient5
> /src/examples/org/apache/hc/client5/http/examples/ClientInterceptors.ja
> va
>
> https://github.com/apache/httpcomponents-client/blob/master/httpclient5
> /src/examples/org/apache/hc/client5/http/examples/AsyncClientMessageTra
> ilers.java
Ok, done.
>> 2) How can I best collect timing probes from establishing the
>> underlying
>> connections? (connection established times).
>>
> By using a custom AsyncClientConnectionOperator, I think
>
> https://github.com/apache/httpcomponents-client/blob/master/httpclient5
> /src/main/java/org/apache/hc/client5/http/nio/AsyncClientConnectionOper
> ator.java

Ok, I will have to take a closer look on how to implant my custom
operator then. But I got the idea.
>
>
>> 3) "a small pool of connections (2 to 5)" Am I reading this
>> correctly,
>> that each AsyncHttpClient instance should be equipped with its own
>> connection manager (setConnectionManager),
> Yes.
>
>
>>  with setMaxConnTotal(5) and
>> setMaxConnPerRoute(5), assuming that each pool has a min of 2? Can I
>> influence the minimum number of connections?
>>
> I am not sure I understand.
How can I configure a pool for a given AsyncHttpClient for a size 2-5
(or 3-10 etc.)?
>> 4) If I want to force my AsyncHttpClients/async HttpRequests setup
>> into
>> a blocking, sequential variant (as implemented using a loop over a
>> BasicHttpClient), can I use a semaphore as hinted at here:
> A Semaphore can help limit the total number of concurrent connections.
> If you want to sequentially execute requests you just need to wait on
> the response future before proceeding to the next request.
I see, too obvious for me, heh :)

Stefan


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to