On 12/01/06, sebb <[EMAIL PROTECTED]> wrote: > On 12/01/06, Roland Weber <[EMAIL PROTECTED]> 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, > > Thanks! > > 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. >
I've now had a look at the code. SimpleConnectionManager only has a single connection, and does not seem to block (unless closing the connection can do so). At present we use a single connection per host per thread - there may be several different host:port combinations in a single thread. So I guess we could use a separate instance of HttpClient per "thread-host". --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]