紧急求助,Apache + Tomcat 的配置的问题

06-07-30 cuis
使用Apache 2.0.58, Tomcat 5.515, jkmod1.2.18 每当运行几个小时就发生没有相应。apache正常运行。而且tomcat中的所有线程都变成无效状态。无效的线程是慢慢增加,直到设置的最大256线程全部无效。

tomcat的状态如下:

jk-8009

Max threads: 256 Min spare threads: 16 Max spare threads: 128 Current thread count: 217 Current thread busy: 99

Max processing time: 69968 ms Processing time: 38981.05 s Request count: 513642 Error count: 19 Bytes received: 0.00 MB Bytes sent: 7187.58 MB

Stage Time B Sent B Recv Client VHost Request

S 3606563 ms 7 KB 0 KB 59.41.36.54 www.test.com GET /test.jsp?session=a00595821ef4 HTTP/1.1

S 3603094 ms 0 KB 0 KB 59.41.36.54 www.test.com GET /test.jsp?session=a00595821ef4

cuis
2006-07-30 19:25
workers的配置:

worker.list=worker1

worker.worker1.port=8009

worker.worker1.host=localhost

worker.worker1.type=ajp13

worker.worker1.socket_keepalive=1

worker.worker1.socket_timeout=120

worker.worker1.connection_pool_size=256

worker.worker1.connection_pool_minsize=16

worker.worker1.connection_pool_timeout=120

worker.worker1.lbfactor=1

tomcat的配置

<Connector port="8009" maxThreads="256" minSpareThreads="16" maxSpareThreads="128" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

cuis
2006-07-30 19:25
Tomcat 配置:

<Connector port="8009" maxThreads="256" minSpareThreads="16" maxSpareThreads="128" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

cuis
2006-07-30 19:29
jk_mod.log

[Sun Jul 30 18:18:23 2006] [5708:7440] [error] jk_ajp_common.c (961): Can't receive the response message from tomcat, network problems or tomcat is down (127.0.0.1:8009), err=-60

[Sun Jul 30 18:18:23 2006] [5708:7440] [error] jk_ajp_common.c (1531): Tomcat is down or refused connection. No response has been sent to the client (yet)

[Sun Jul 30 18:18:47 2006] [5708:6684] [error] jk_ajp_common.c (961): Can't receive the response message from tomcat, network problems or tomcat is down (127.0.0.1:8009), err=-60

[Sun Jul 30 18:18:47 2006] [5708:6684] [error] jk_ajp_common.c (1531): Tomcat is down or refused connection. No response has been sent to the client (yet)

[Sun Jul 30 18:20:33 2006] [5708:0568] [error] jk_ajp_common.c (961): Can't receive the response message from tomcat, network problems or tomcat is down (127.0.0.1:8009), err=-60

[Sun Jul 30 18:20:33 2006] [5708:0568] [error] jk_ajp_common.c (1531): Tomcat is down or refused connection. No response has been sent to the client (yet)

[Sun Jul 30 18:22:33 2006] [5708:0568] [error] jk_ajp_common.c (961): Can't receive the response message from tomcat, network problems or tomcat is down (127.0.0.1:8009), err=-60

[Sun Jul 30 18:22:33 2006] [5708:0568] [error] jk_ajp_common.c (1531): Tomcat is down or refused connection. No response has been sent to the client (yet)

[Sun Jul 30 18:22:33 2006] [5708:0568] [error] jk_ajp_common.c (1794): Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong port. worker=worker1 failed

[Sun Jul 30 18:23:09 2006] [5708:8004] [error] jk_ajp_common.c (961): Can't receive the response message from tomcat, network problems or tomcat is down (127.0.0.1:8009), err=-60

[Sun Jul 30 18:23:09 2006] [5708:8004] [error] jk_ajp_common.c (1531): Tomcat is down or refused connection. No response has been sent to the client (yet)

zawecha1
2010-09-16 10:58
在workers.properties里设置相应的负载机器的recovery_options=3就可以了。

解释:

recovery_options属性说明了web server在检测到Tomcat失败后如何进行恢复工作。默认情况下,web server将转发请求给处于负载平衡模式中的另一个Tomcat。属性值为0,说明全部恢复;属性值为1,说明如果在Tomcat接到请求后出现失败状况,则不进行恢复;属性值为2,说明如果在Tomcat发送http头给客户端后出现失败状况,则不进行恢复;属性值为3,说明如果在Tomcat接到请求后出现失败状况或者在Tomcat发送http头给客户端后出现失败状况,则不进行恢复。此属性在jk 1.2.6版本被增加进来,以求避免Tomcat的死机和在支持ajp13的servlet引擎上发生的问题。此属性默认为全部恢复。

因在默认的情况下,JK检测tomcat的工作情况,所以浪费了很多资源,这个资源多到比tomcat正常工作所需的资源的1.6倍还多。如果不检测恢复,则效率高了,处理的请求数可以是原来的2.6倍多,而且tomcat还不死--没响应,反而使出错的数量比检测恢复之后出错的数量还少,性能还加强了,如果原来用这种的集群78台机器,有一阵就挂掉,改成这个配置只要30台机器,一般在同样的时间段内运行无反应或出错的情况比recovery_options使用默认值的少。

猜你喜欢