1. 程式人生 > >tomcat6.0的大量CLOSE_WAIT解決方案

tomcat6.0的大量CLOSE_WAIT解決方案

遇到tomcat closedwait相關解決方案

方案一,在tomcat的workers.properties裡面配置相關條件

worker.tomcat.lbfactor=50
worker.tomcat.cachesize=10
worker.tomcat.cache_timeout=600
worker.tomcat.socket_keepalive=1
worker.tomcat.socket_timeout=300

方案二,優化伺服器核心引數(/etc/sysctl.conf)
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_keepalive_time=1800
net.ipv4.tcp_keepalive_probes=4
net.ipv4.tcp_keepalive_intvl=15

方案三,關閉tomcat的keepalive引數

方案四,做定時任務檢查httpd程序數目,一旦發現httpd程序數目異常,就重啟apache和tomcat

<strong> 針對於本專案目前的狀況,我採用了方案四,編寫了linux shell指令碼如下:</strong>

#!/bin/sh
httpcount=`ps -ef|grep httpd|wc -l`
echo $httpcount
if [ $httpcount -gt 900 ]; then
  killall httpd
  killall java
  /cicro/wcm/bin/startas.sh
  echo "Restart successfully because of much useless process."
else
  echo "It is OK!"
fi

本文只是記錄網上相關解決方案,原鏈http://www.myexception.cn/operating-system/1276416.html