You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bhaskar <bh...@yahoo-inc.com> on 2005/07/13 09:08:51 UTC

Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process

Hi,
I am running tomcat 5.0.28 on Linux (2.6.9-5.ELsmp #1 SMP Wed Jan 5 
19:29:47 EST 2005 x86_64 x86_64 x86_64 GNU/Linux).

I am having another test box which runs java process with 1000 
threads(each thread will send 10000 http requests to above tomcat server 
in the delay of 1 ms). This test process uses the HttpCommon api's to 
make use of http connection pool's keep alive capability.
Each thread in the above test process will send the post request to the 
tomcat using HttpClient.excecuteMethod.

If I check the avg response time in the tomcat server it is somewhere 
around 12 to 20 ms

But in the test process, the time taken to execute the 
HttpClient.executeMethod varies between 3 ms to 21855 ms  (avg: 1723.61 ms)

Parallely (still above test process is running) I start same test 
process from the same test box with 10 threads (each thread will send 10 
http requests to above tomcat in the delay of 1 ms). Now I see the time 
taken to execute the HttpCleint.executeMethod varies between 9ms to 146 
ms (avg: 32.47 ms).

The difference between first process and second process is number of 
threads.  I am trying to understand the reason on why 
HttpClient.executeMethod is taking more time if I have more number of 
threads trying to send the http request?

Do I need to fine tune something to make it better? Is it a expected 
behaviour ? if yes, any reason?
Or I am doing something wrong my code ?

TIA,
Bhaskar


PS: java version "1.4.2-02"
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.2-02)
Java HotSpot(TM) Client VM (build Blackdown-1.4.2-02, mixed mode)

At some point if I check the number of established connections thru 
netstat in test box, I see the following figure:

# netstat -a|grep tomcatserver|grep ESTABLISHED|wc -l
528