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:[EMAIL PROTECTED] 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 1 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process
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:[EMAIL PROTECTED] 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 1 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process
Hi, Tomcat's max threads by default is usually around 75. I you fire 10 at it then they all get serviced immediately. If you send 1000, all 75 get taken up, meaning a queue forms for the 1000-75 remaining threads until Tomcat has spare threads for them. Allistair -Original Message- From: Bhaskar [mailto:[EMAIL PROTECTED] Sent: 13 July 2005 09:26 To: Tomcat Users List Subject: Re: Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process 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:[EMAIL PROTECTED] 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 1 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process
Hi, I would think that is because Tomcat's max threads by default is usually around 75. I you fire 10 at it then they all get serviced immediately. If you send 1000, all 75 get taken up, meaning a queue forms for the 1000-75 remaining threads until Tomcat has spare threads for them. Allistair -Original Message- From: Bhaskar [mailto:[EMAIL PROTECTED] Sent: 13 July 2005 09:26 To: Tomcat Users List Subject: Re: Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process 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:[EMAIL PROTECTED] 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 1 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process
Oh I forgot to mention. Currently, the max thread size is 3000. Note that both the client processes will run simultaniously. One with more threads runs for long and one with less number of threads stops quickly. Moreover if tomcat runs out of threads then it will clearly put the info in the log telling that 'you are running out of threads' Bhaskar Allistair Crossley wrote: Hi, I would think that is because Tomcat's max threads by default is usually around 75. I you fire 10 at it then they all get serviced immediately. If you send 1000, all 75 get taken up, meaning a queue forms for the 1000-75 remaining threads until Tomcat has spare threads for them. Allistair -Original Message- From: Bhaskar [mailto:[EMAIL PROTECTED] Sent: 13 July 2005 09:26 To: Tomcat Users List Subject: Re: Perf Issue: HttpClient.executeMethod takes more time if there are more number of threads in the process 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:[EMAIL PROTECTED] 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 1 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- /FONT