Tomcat服务问题,Cpu100%,急需帮助,请高手指点,谢谢!!!

04-05-19 hopeful_liu
问题描述:

我的网站应用运行三五天后,web就无法访问了;进入服务器用top命令查看系统资源,

cpu占用率100%,sleeping进程达到了1000多个,Tomcat后台抛出以下错误:

2004-05-18 23:20:04 Ajp13Processor[8009][69] process: invoke

java.io.IOException: Broken pipe

at java.net.SocketOutputStream.socketWrite(Native Method)

at java.net.SocketOutputStream.write(SocketOutputStream.java:83)

at org.apache.ajp.Ajp13.send(Ajp13.java:525)

at org.apache.ajp.RequestHandler.finish(RequestHandler.java:501)

at org.apache.ajp.Ajp13.finish(Ajp13.java:395)

at org.apache.ajp.tomcat4.Ajp13Response.finishResponse(Ajp13Response.java:196)

at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:464)

at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)

at java.lang.Thread.run(Thread.java:484)

2004-05-18 08:14:13 Ajp13Processor[8009][96] Starting background thread

2004-05-18 08:14:13 Ajp13Processor[8009][97] Starting background thread

2004-05-18 08:14:14 Ajp13Processor[8009][98] Starting background thread

2004-05-18 08:14:23 Ajp13Processor[8009][99] Starting background thread

2004-05-04 00:00:49 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:00:49 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:00:49 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:01:21 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:01:21 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:01:21 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:02:08 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:02:08 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:02:08 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:02:17 Ajp13Connector[8009] No processor available, rejecting this connection

2004-05-04 00:02:17 Ajp13Connector[8009] No processor available, rejecting this connection

通过以上分析,Tomcat在后台一直新建了非常多的进程,但是用过的进程为什么不能再重新使用或回收能,这点我很不明白;

我检查数据库操作的程序,ResultSet 和Connection都有关闭。

目前没找出问题所在,请各位高手指点,非常感谢!!

服务器环境:

RedHat Linux7.2+Apache1.3+mod_jk-1.3-noeapi.so+Tomcat4.06+Oracle

CPU两个,RAM:2G SWAP:2G

应用技术架构:jsp+JavaBean+Oracle

Apache的httpd.conf主要配置:

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

MinSpareServers 5

MaxSpareServers 20

StartServers 8

MaxClients 360

MaxRequestsPerChild 0

Tomcat的主要配置:

在catalina.sh加了JAVA_OPTS="-Xms1024m -Xmx1640m"(设置JVM最大内存)

Server.xml的主要配置如下:

<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"

port="8009" minProcessors="5" maxProcessors="100"

acceptCount="10" debug="0"/>

使用Tomcat自带的连接池,连接池配置如下:

<parameter>

<name>removeAbandoned</name>

<value>true</value>

</parameter>

<parameter>

<name>removeAbandonedTimeout</name>

<value>10</value>

</parameter>

<parameter>

<name>maxActive</name>

<value>100</value>

</parameter>

<parameter>

<name>maxIdle</name>

<value>30</value>

</parameter>

<parameter>

<name>maxWait</name>

<value>9000</value>

</parameter>

banq
2004-05-21 09:17
典型的内存泄漏。

liloboy
2004-05-27 21:41
tomcat4我感觉不是太Reliable.

试试看tomcat5或者Jetty吧?

你一定会吓一跳.

进程的问题,应该和tomcat的关系不大,倒是和jk和apache大大有关系,去看看jk和apache的配置和版本,其实现在jk2更好,用用jk2应该更不错.

我觉的,开n个tomcat用jk做load balance比开一个jvm要负载更加优秀.

还有,用用Linux上面bea的JDK会更好.

freecode
2004-06-07 22:24
楼上提到了jetty,有什么资料可参考吗,看网上有人说jetty性能比tomcat要好。

猜你喜欢