hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Usage of HttpConnection v. HttpClient
Date Thu, 12 Jan 2006 13:50:28 GMT
On 12/01/06, Roland Weber <http-async@dubioso.net> wrote:
> sebb wrote:
> > We are using HttpClient in Apache JMeter.
> > This uses multiple threads to simulate multiple users.
> >
> > We don't use HttpClient and a Connection Manager, as we specifically
> > don't want to share connections between threads. Instead, we create
> > our own HttpConnection objects and pass these to
> >
> >         method.execute(state.connection).
> >
> > I'm now wondering whether this is a sensible approach?
> >
> > Perhaps we are missing out by not using a method such as:
> >
> >     httpClient.executeMethod(method)
> >
> > I would have expected the two approaches to be much the same, but on
> > looking at the latter, this is handled via HttpMethodDirector, which
> > seems to do rather more than method.execute() does.
> >
> > Should we be using a customised ConnectionManager instead?
> No need to use a customized ConnectionManager. Just create a
> separate instance of HttpClient for each thread. By default,
> HttpClient instances get a SimpleConnectionManager which uses
> a single connection. This will provide the thread separation
> you require, while allowing you to use httpClient.executeMethod.
> hope this helps,


I've looked at the SimpleConnectionManager docs, but I can't seem to
determine what happens if a single thread makes requests to different
host-port combinations without closing them in between.

getConnection[WithTimeout] says that it blocks until a connection is
available, but there is no clue as to what "available" means.

Also, there does not appear to be a shutdown() method. This suggests
that the thread will need to keep track of all its connections.


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

View raw message