On Thu, 2011-06-30 at 03:32 -0700, bnijjhar wrote:
> Hi
> I have implemented a global HttpClient with a ThreadSafeClientConnManager.
> The default max connections per route is set to 1. I also set up the URL to
> access to be on another machine.
> I then create and start 2 threads to call my HttpClient.

Having two threads and one HTTP connection looks somewhat, well, strange
to me.  


>  The first one
> completes in a reasonable time; the second one takes a bit too long. When I
> analyse the context logs, I see that in the first thread, the time between
> the following two messages is very close:
> 
> 2011-06-29 14:37:56,981 Thread-1 DEBUG
> org.apache.http.impl.client.DefaultHttpClient  - Connection can be kept
> alive indefinitely
> 2011-06-29 14:37:56,981 Thread-1 DEBUG
> org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager  - Released
> connection is reusable.
> 
> However, I am consistently seeing a 1 second gap for the second thread
> (which was notified at 14:37:56.981 that a connection was now available, as
> expected) between these two messages:
> 
> 2011-06-29 14:37:56,997 Thread-2 DEBUG
> org.apache.http.impl.client.DefaultHttpClient  - Connection can be kept
> alive indefinitely
> 2011-06-29 14:37:58,169 Thread-2 DEBUG
> org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager  - Released
> connection is reusable.
> 
> I have tried adding lines such as EntityUtils.consume(entity) and
> inputstream.close() but they made no difference (it seems that connections
> are released anyway without them according to the debug above). 
> 
> Could anyone explain this gap? If the URL I connect to is on my local
> machine, it doesn't seem to occur ... Obviously, it does mean that my
> performance isn't what I'd like it to be (or feel confident in).

Post a _complete_ wire / context log of the session.

Oleg



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

Reply via email to