某項目投產前壓力測試過程中:當並發達到50的時候出現系統無法訪問並報錯。如附圖。
“Too many open files”
遇到此問題首先要檢查系統本身允許打開文件最大數,然後weblogic本身也存在允許打開文件最大數。
經排查系統打開最大數未限制。問題定位是weblogic的問題。
解決方法:
在/weblogic/Oracle/Middleware/wlserver_10.3/common/bin文件夾下找到commEnv.sh,修改文件:
resetFd() {
if [ ! -n "`uname -s |grep -i cygwin || uname -s |grep -i windows_nt || \
uname -s |grep -i HP-UX`" ]
then
ofiles=`ulimit -S -n`
maxfiles=`ulimit -H -n`
if [ "$?" = "0" -a `expr ${maxfiles} : '[0-9][0-9]*$'` -eq 0 -a `expr ${ofiles} : '[0-9][0-9]*$'` -eq 0 ]; then
#ulimit -n 4096
<strong><span style="color:#ff0000;">ulimit -n 65536</span></strong>
else
if [ "$?" = "0" -a `uname -s` = "SunOS" -a `expr ${maxfiles} : '[0-9][0-9]*$'` -eq 0 ]; then
if [ ${ofiles} -lt 65536 ]; then
ulimit -H -n 65536
else
ulimit -H -n ${ofiles}
fi
fi
fi
fi
}
如圖將“4096”修改爲“65536”,然後壓力就上去了!