tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GOMEZ Henri <hgo...@slib.fr>
Subject mod_jk / Ajp13 config fix on heavily loaded system
Date Tue, 13 Nov 2001 22:45:22 GMT
Hi to all,

Some of you may have experienced problems on heavily 
loaded system with mod_jk and Tomcat 3.2/3.3 when using
ajp13.

As you may know, the Ajp13 connection is permanent
and is created each time a WebServer task, for
example an Apache child, have to forward a request
to Tomcat. 

And in Apache server case, the child will stay alive,
until the client requests load decrease, or when 
a child have passed 1000 requests (MaxRequestsPerChild 1000).
And till the child close the connection, the Tomcat thread
stay alive.

By default Apache server support up to 150 childs :
(MaxClients 150 in httpd.conf)

But by default, the Ajp13 Interceptor won't use more
than 100 threads, so you're stuck when the 101th Apache
child want to forward a request and see the following
infamous trace in mod_jk.log :

[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (196)]: In
jk_endpoint_t::connect_to_tomcat, failed errno = 111
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (635)]: Error connecting
to the Tomcat process.
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (848)]: In
jk_endpoint_t::service, send_request failed in send loop 2
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (228)]:
connection_tcp_get_message: Error - jk_tcp_socket_recvfull failed
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (712)]: Error reading
reply
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (845)]: In
jk_endpoint_t::service, get_reply failed in send loop 0
[wed oct 31 11:03:21 2001]  [jk_connect.c (143)]: jk_open_socket,
connect() failed errno = 111
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (196)]: In
jk_endpoint_t::connect_to_tomcat, failed errno = 111
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (635)]: Error connecting
to the Tomcat process.
 
In some case, Apache could be able to connect, since Tomcat listening
thread will accept incoming connection, but will drop it later if it
fail to give the socket to a new thread. In that case you'll see 
only in log :

[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (848)]: In
jk_endpoint_t::service, send_request failed in send loop 2
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (228)]:
connection_tcp_get_message: Error - jk_tcp_socket_recvfull failed
[wed oct 31 11:03:21 2001]  [jk_ajp13_worker.c (712)]: Error reading
reply

Fortunatly, the fix is easy, just configure Ajp13Connector in
server.xml to support up to 150 threads (or whatever you define
as MaxClients in Apache, didn't know how on IIS/iPlanet).

        <Ajp13Connector port="8009" 
			   maxThreads="150"
			   maxSpareThreads="50"
			   minSpareThreads="10" />

Also you should take care of the number of descriptors
opened in your webapplication, which is :

  Tomcat used descriptors (sockets, files) 
+ YouWebApp descriptors (files, sockets, jdbc...)

The JVM, like any others process have a limit on the number
of descriptors it could open (and of course on number of threads).

So take care of closing no more used socket, files and so on.


-
Henri Gomez                 ___[_]____
EMAIL : hgomez@slib.fr        (. .)                     
PGP KEY : 697ECEDD    ...oOOo..(_)..oOOo...
PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6 

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message