[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: How to measure response time with MultiThreadedHttpConnectionManager?
From:       Roland Weber <http-async () dubioso ! net>
Date:       2006-04-21 18:20:47
Message-ID: 4449227F.2050607 () dubioso ! net
[Download RAW message or body]

Hello Don,

> I have multiple hosts, with multiple requests to each.  I'm setting both
> setMaxTotalConnections() and setMaxConnectionsPerHost() to the total
> number of URLs, so I think max connections per host is higher than it
> really needs to be.

There might be another bug in your application that prevents concurrency
and efficient connection use. There might be other factors in your
environment that I am not aware of, such as a proxy or router that
throttles bandwidth and/or connections.

> I do think I only have one connection per thread, because I'm following
> the MultiThreadedExample at
> http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/httpclient/bran
> ches/HTTPCLIENT_2_0_BRANCH/src/examples/MultiThreadedExample.java?view=m
> arkup which starts one thread per URL.

> Are you saying that's not a good practice?

Yes, that's what I'm saying. The example is an example how to use
the API from multiple threads. It is not an example for designing
a multi-threaded HTTP application.

> If so, can you give me any guidance on the best ratio of
> threads to connections?

No I can't. Determining such ratios is usually left to the
performance tuning phase of a project. I have no idea what
your application is supposed to do, nor how it is structured.
In general, you should not start more threads than you think
you will *need*. Limiting the number of threads will also
reduce the load on the target servers, and allows for
connection re-use. If you want to stress-test the servers,
starting many threads is good. But even then, having each
thread execute several requests will put more stress on the
server than having each thread execute only one request.

hope that helps,
  Roland


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic