You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Allistair Crossley <Al...@QAS.com> on 2005/07/13 10:11:24 UTC

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

Complete stab in the dark here ... Tomcat serves a maximum number of threads at a time (request processing threads). It may be that Tomcat's timings are accurate for the threads *when* it executes them, but your HTTP Client will be seeing a queue when Tomcat has no spare request thread capacity. You can tweak this with the max processors attribute for Tomcat's connectors.

Just a guess, take with pinch of salt.

Allistair

> -----Original Message-----
> From: Bhaskar [mailto:bhaskar@yahoo-inc.com]
> Sent: 13 July 2005 08:09
> To: Tomcat Users List
> Subject: 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
> 


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


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


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

Posted by Bhaskar <bh...@yahoo-inc.com>.
In my testbox, both of the following processes are running simultaniously:

java testprocess 1: 1000 threads  (avg time to execute the 
executeMethod:1723.61 ms)
java testprocess 2: 10 threads (avg resp time to execute the 
executeMethod: 32 ms)

If it is to do with max processor attribute of Tomcat server side then 
how come I am seeing good response with another test java process which 
had less number of threads ?

More over in tomcat, I am seeing the average response time as 12 to 20 
ms. If there is a problem in tomcat side, then i might have seen huge 
numbers here.

Bhaskar


Allistair Crossley wrote:

>Complete stab in the dark here ... Tomcat serves a maximum number of threads at a time (request processing threads). It may be that Tomcat's timings are accurate for the threads *when* it executes them, but your HTTP Client will be seeing a queue when Tomcat has no spare request thread capacity. You can tweak this with the max processors attribute for Tomcat's connectors.
>
>Just a guess, take with pinch of salt.
>
>Allistair
>
>  
>
>>-----Original Message-----
>>From: Bhaskar [mailto:bhaskar@yahoo-inc.com]
>>Sent: 13 July 2005 08:09
>>To: Tomcat Users List
>>Subject: 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
>>
>>    
>>
>
>
><FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
>-------------------------------------------------------
>QAS Ltd.
>Registered in England: No 2582055
>Registered in Australia: No 082 851 474
>-------------------------------------------------------
></FONT>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>  
>