You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ra...@seagate.com on 2006/07/28 21:03:09 UTC

connectionTimeout and reusing Tomcat threads

 Hello

I have an application which uses Apache(2.0.53) as the Webserver and
mod_jk(1.2.10) to forward servlet/jsp requests to Tomcat(5.0) as part of
the JBoss container - all running on Linux.
It looks like mod_jk is not reusing the existing connections that it
establishes with the Tomcat resulting in a large number of Tomcat threads
which are in KeepAlive state as reported   by the Tomcat console.
I do not have any timeouts set either on the Apache side or Tomcat side of
the connector.
The JBoss/Tomcat 5.0 document states that the default connectionTimeout
within the AJP 1.3 connector on the Tomcat side is 60 seconds but it does
not seem to be the case.

I am trying to force this connectionTimeout to clean up the large number of
Tomcat threads, but i am not sure if this is the best thing to do.
Is there anything on the Apache side in the workers.properties that i could
specify to make sure mod_jk reuses these connections.

Thanks



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: connectionTimeout and reusing Tomcat threads

Posted by Ra...@seagate.com.
Rainer,

Thanks for your suggestion. I tried out the 1.2.18 version  of
mod_jk(mod_jk-apache-2.0.46-linux-i686.so)  but the behaviour seems to be
very similar.  Here is some of the information that you asked for.  For the
purpose of the test, i have only one Tomcat worker available. Though i had
only 1 client making requests every 5 seconds Tomcat  started up 7 threads
after the client had made 10 requests.

Thanks

Ramdas


####################from httpd.conf##################
JkWorkersFile conf/workers.properties
JkShmFile logs/mod_jk.shm
JkLogFile logs/mod_jk.log
#JkLogLevel info
JkLogLevel trace

# Forward jsp requests to JBoss
JkMount /*.jsp loadbalancer

##############from ssl.conf####################
JkMount /*.jsp loadbalancer
JkMount /bigweb/* loadbalancer
JkMount /bigdev03/* dev03s
JkMount /bigdev04/* dev04s

********************* output from tomcat web
status***********************************
Max threads: 220 Min spare threads: 1 Max spare threads: 1 Current thread
count: 7 Current thread busy: 7
Max processing time: 69 ms Processing time: 0 s Request count: 10 Error
count: 0 Bytes received: 0.00 MB Bytes sent: 0.00 MB


                                                                         
  Stage     Time      B Sent   B Recv      Client     VHost    Request   
                                                                         
 K       33057 ms    ?        ?         **.24.0.63   ?        ?          
                                                                         
 K       27926 ms    ?        ?         **.24.0.63   ?        ?          
                                                                         
 K       17666 ms    ?        ?         **.24.0.63   ?        ?          
                                                                         
 K       12538 ms    ?        ?         **.24.0.63   ?        ?          
                                                                         
 K       38182 ms    ?        ?         **.24.0.63   ?        ?          
                                                                         
 K       22792 ms    ?        ?         **.24.0.63   ?        ?          
                                                                         


*********************************netstat
output**********************************
tcp        0      0 xx.24.0.87:36275        xx.24.0.63:3306
ESTABLISHED
tcp        0      0 xx.24.0.87:36274        xx.24.0.63:3306
ESTABLISHED
tcp        0      0 xx.24.0.87:36278        xx.24.0.63:3306
ESTABLISHED
tcp        0      0 xx.24.0.87:36277        xx.24.0.63:3306
ESTABLISHED
tcp        0      0 xx.24.0.87:36276        xx.24.0.63:3306
ESTABLISHED

*************************************mod_jk.log*********************************output
 logged for 1 request from client*****************************
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
get_most_suitable_worker::jk_lb_worker.c (600): found best worker dev04
(dev04) using method 'Request'
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
get_most_suitable_worker::jk_lb_worker.c (604): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
get_endpoint::jk_ajp13_worker.c (72): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_get_endpoint::jk_ajp_common.c (2137): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_get_endpoint::jk_ajp_common.c (2164): acquired connection pool slot=0
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_get_endpoint::jk_ajp_common.c (2167): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
get_endpoint::jk_ajp13_worker.c (74): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug] service::jk_lb_worker.c
(648): service worker=dev04 jvm_route=dev04
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_service::jk_ajp_common.c (1658): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_marshal_into_msgb::jk_ajp_common.c (386): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_marshal_into_msgb::jk_ajp_common.c (566): ajp marshaling done
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_marshal_into_msgb::jk_ajp_common.c (567): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_service::jk_ajp_common.c (1698): processing dev04 with 2 retries
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_send_request::jk_ajp_common.c (1166): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_send_message::jk_ajp_common.c (905): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (909): sending to ajp13
pos=4 len=217 max=8192
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (909): 0000    12 34 00 D5
02 04 00 08 48 54 54 50 2F 31 2E 31  -
.4......HTTP/1.1.........................
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_send_message::jk_ajp_common.c (926): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_send_request::jk_ajp_common.c (1264): request body to send 192 -
request body to resend 0
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_read_into_msg_buff::jk_ajp_common.c (1106): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_read_fully_from_server::jk_ajp_common.c (1060): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_read_into_msg_buff::jk_ajp_common.c (1142): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_send_message::jk_ajp_common.c (905): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (909): sending to ajp13
pos=4 len=198 max=8192
.......................................
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_send_message::jk_ajp_common.c (926): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_send_request::jk_ajp_common.c (1359): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_get_reply::jk_ajp_common.c (1501): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (949): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1037): received from ajp13
pos=0 len=3 max=8192
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1037): 0000    06 1F FA 00
00 00 00 00 00 00 00 00 00 00 00 00  - ................
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_process_callback::jk_ajp_common.c (1374): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_read_into_msg_buff::jk_ajp_common.c (1106): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_read_fully_from_server::jk_ajp_common.c (1060): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_read_into_msg_buff::jk_ajp_common.c (1142): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_process_callback::jk_ajp_common.c (1439): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_send_message::jk_ajp_common.c (905): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (909): sending to ajp13
pos=4 len=4 max=8192
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (909): 0000    12 34 00 00
00 00 00 00 00 00 00 00 00 00 00 00  - .4..............
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_send_message::jk_ajp_common.c (926): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (949): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1037): received from ajp13
pos=0 len=161 max=8192
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1037): 0000    04 00 C8 00
02 4F 4B 00 00 03 00 0C 58  ................
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_process_callback::jk_ajp_common.c (1374): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_unmarshal_response::jk_ajp_common.c (604): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_unmarshal_response::jk_ajp_common.c (621): status = 200
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_unmarshal_response::jk_ajp_common.c (628): Number of headers is = 3
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_unmarshal_response::jk_ajp_common.c (684): Header[0] [X-Powered-By] =
[Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.6 (build: CVSTag=JBoss_3_2_6
date=200410140106)]
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_unmarshal_response::jk_ajp_common.c (684): Header[1] [Content-Type] =
[text/xml]
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_unmarshal_response::jk_ajp_common.c (684): Header[2] [Content-Length] =
[299]
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_unmarshal_response::jk_ajp_common.c (691): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (949): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1037): received from ajp13
pos=0 len=303 max=8192
....................
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_process_callback::jk_ajp_common.c (1374): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug] ws_write::mod_jk.c (412):
written 299 out of 299
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_process_callback::jk_ajp_common.c (1476): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (949): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1037): received from ajp13
pos=0 len=2 max=8192
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1037): 0000    05 01 00 00
00 00 00 00 00 00 00 00 00 00 00 00  - ................
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_process_callback::jk_ajp_common.c (1374): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_process_callback::jk_ajp_common.c (1465): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_get_reply::jk_ajp_common.c (1588): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace]
ajp_service::jk_ajp_common.c (1733): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace] ajp_done::jk_ajp_common.c
(2077): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug] ajp_done::jk_ajp_common.c
(2107): recycling connection pool slot=0 for worker dev04
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace] ajp_done::jk_ajp_common.c
(2110): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace] service::jk_lb_worker.c
(726): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace] done::jk_lb_worker.c
(846): enter
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace] done::jk_lb_worker.c
(857): exit
[Sun Jul 30 20:38:03 2006] [22029:16384] [debug] jk_handler::mod_jk.c
(1962): Service finished with status=200 for worker=loadbalancer
[Sun Jul 30 20:38:03 2006] [22029:16384] [trace] jk_handler::mod_jk.c
(1965): exit


                                                                           
             Rainer Jung                                                   
             <rainer.jung@kipp                                             
             data.de>                                                   To 
             No Phone Info             Tomcat Users List                   
             Available                 <us...@tomcat.apache.org>           
                                                                        cc 
                                                                           
             07/28/2006 01:41                                      Subject 
             PM                        Re: connectionTimeout and reusing   
                                       Tomcat threads                      
                                                                           
             Please respond to                                             
               "Tomcat Users                                               
                   List"                                                   
             <users@tomcat.apa                                             
                 che.org>                                                  
                                                                           
                                                                           




I know this sounds very general, but 1.2.10 is quite antique. First
update to 1.2.18, try again and if your problem is still reproducible,
post your config (workers.properties and Jk* from httpd.conf) and
relevant parts of the mod_jk-Logfile with LogLevel trace.

Also try to relate tcp connection information from netstat using you AJP
port to your thread observations.

Regards,

Rainer

Ramdas.Hegde@seagate.com schrieb:
>  Hello
>
> I have an application which uses Apache(2.0.53) as the Webserver and
> mod_jk(1.2.10) to forward servlet/jsp requests to Tomcat(5.0) as part of
> the JBoss container - all running on Linux.
> It looks like mod_jk is not reusing the existing connections that it
> establishes with the Tomcat resulting in a large number of Tomcat threads
> which are in KeepAlive state as reported   by the Tomcat console.
> I do not have any timeouts set either on the Apache side or Tomcat side
of
> the connector.
> The JBoss/Tomcat 5.0 document states that the default connectionTimeout
> within the AJP 1.3 connector on the Tomcat side is 60 seconds but it does
> not seem to be the case.
>
> I am trying to force this connectionTimeout to clean up the large number
of
> Tomcat threads, but i am not sure if this is the best thing to do.
> Is there anything on the Apache side in the workers.properties that i
could
> specify to make sure mod_jk reuses these connections.
>
> Thanks
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: connectionTimeout and reusing Tomcat threads

Posted by Rainer Jung <ra...@kippdata.de>.
I know this sounds very general, but 1.2.10 is quite antique. First
update to 1.2.18, try again and if your problem is still reproducible,
post your config (workers.properties and Jk* from httpd.conf) and
relevant parts of the mod_jk-Logfile with LogLevel trace.

Also try to relate tcp connection information from netstat using you AJP
port to your thread observations.

Regards,

Rainer

Ramdas.Hegde@seagate.com schrieb:
>  Hello
> 
> I have an application which uses Apache(2.0.53) as the Webserver and
> mod_jk(1.2.10) to forward servlet/jsp requests to Tomcat(5.0) as part of
> the JBoss container - all running on Linux.
> It looks like mod_jk is not reusing the existing connections that it
> establishes with the Tomcat resulting in a large number of Tomcat threads
> which are in KeepAlive state as reported   by the Tomcat console.
> I do not have any timeouts set either on the Apache side or Tomcat side of
> the connector.
> The JBoss/Tomcat 5.0 document states that the default connectionTimeout
> within the AJP 1.3 connector on the Tomcat side is 60 seconds but it does
> not seem to be the case.
> 
> I am trying to force this connectionTimeout to clean up the large number of
> Tomcat threads, but i am not sure if this is the best thing to do.
> Is there anything on the Apache side in the workers.properties that i could
> specify to make sure mod_jk reuses these connections.
> 
> Thanks
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org