hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Cohen <sco...@javactivity.org>
Subject Re: Right way to simulate session connections in loadtesting simulator using HttpClient
Date Tue, 09 Dec 2014 19:29:05 GMT
On 12/09/2014 12:29 PM, Steve Cohen wrote:
> On 12/09/2014 07:56 AM, Oleg Kalnichevski wrote:
>> On Mon, 2014-12-08 at 11:37 -0600, Steve Cohen wrote:
>>> To be a little more specific about what I am looking for:
>>> The standard way of creating HttpClients seems to be
>>> HttpClientBuilder.build().  If you don't specify an
>>> HttpClientConnectionManager, the pooled one will be used, which is not
>>> what I want.  If I specify, instead, a BasicHttpClientConnectionManager,
>>> and then try to work through the HttpClient, closing it at the end of
>>> the session, I get all sorts of IllegalStateExceptions due to the
>>> underlying state of the connection.
>>>
>>
>> What sorts of IllegalStateException specifically?
>>
>> Oleg
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>>
> Well, I've been trying so many different things, I've seen them all.
> "Connection is still allocated".
> "The input stream is null."
> "Connection Manager has been shut down".
>
> It just isn't clear what the life cycle of all these objects should be.
>
> What I want is simple conceptually but hard to execute:
>
> In each thread:
> Open a connection
> Send five messages in sequence (with sleeps in between some of them) on
> that same connection
> Close connection so that next iteration on that thread will need to make
> it from scratch.
>
> I want no optimizations about calls to same host use same connection.
> I want no connection pooling.
> I want to reuse the connection when I want to reuse it and to make a new
> one when I want to make a new one.  One connection per thread.
>
> Then there is the paucity of documentation about the
> BasicHttpClientConnectionManager.  Much of what documentation there is
> seems to imply that one should interact with it using the low level
> interfaces of HttpConnection rather than the higher level HttpClient.
> But few examples.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

I'll stand by what I said about the paucity of documentation on 
BasicHttpClientConnectionManager, but the answers are simple.  For a 
scenario such as mine the answer is to reuse NO HttpClient objects, 
HttpClient, the connection, the connection manager, but to rebuild all 
of these every time a thread wants to initiate a new session.  This 
works, is conceptually simple.

However the paucity of documentation has led to some OTHER unofficial 
documentation being seen, which is of dubious value.

Nonetheless, I have want I want working.


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


Mime
View raw message