一次weblogic调优的经过
项目组反应数据库有问题,
检查发现sga还用的默认参数,缓冲区命中率很低。根据系统内存调整后,好像系统正常了。数据库调整就算是结束了
一天后,我再登这个数据库的时候,发现一个提示说线程已经超过限制,不允许再登录。然后我去修改了process到250,增加并发连接数。然后重启了数据库。当天没发生什么事情,第二天,发现250又被撑满了,这个时候,我就开始换衣中间件有问题,登入中间件那边看了下日志,一直报错,提示无法打开新的连接。一般来说,中间件连接数据库能开10个都算可以了。至少websphere是这样,weblogic应该差不多。然后修改了一下,调整了weblogic的连接池,修改最大连接到100.
1、 报错信息
<2008-4-22 上午04时33分18秒 CST> <Error> <WebLogicServer> <BEA-000337> <ExecuteT
hread: '1' for queue: 'weblogic.kernel.Default' has been busy for "102" seconds
working on the request "Http Request: /guestAction.jsp", which is more than the
configured time (StuckThreadMaxTime) of "60" seconds.>
<2008-4-22 上午04时33分18秒 CST> <Error> <WebLogicServer> <BEA-000337> <ExecuteT
hread: '7' for queue: 'weblogic.kernel.Default' has been busy for "178" seconds
working on the request "Http Request: /guestAction.jsp", which is more than the
configured time (StuckThreadMaxTime) of "60" seconds.>
<2008-4-22 上午04时34分18秒 CST> <Error> <WebLogicServer> <BEA-000337> <ExecuteT
hread: '0' for queue: 'weblogic.kernel.Default' has been busy for "111" seconds
working on the request "Http Request: /guestAction.jsp", which is more than the
configured time (StuckThreadMaxTime) of "60" seconds.>
<2008-4-22 上午04时34分18秒 CST> <Error> <WebLogicServer> <BEA-000337> <ExecuteT
hread: '1' for queue: 'weblogic.kernel.Default' has been busy for "162" seconds
working on the request "Http Request: /guestAction.jsp", which is more than the
configured time (StuckThreadMaxTime) of "60" seconds.>
<2008-4-22 上午04时35分18秒 CST> <Error> <WebLogicServer> <BEA-000337> <ExecuteT
hread: '0' for queue: 'weblogic.kernel.Default' has been busy for "171" seconds
working on the request "Http Request: /guestAction.jsp", which is more than the
configured time (StuckThreadMaxTime) of "60" seconds.>
<2008-4-22 上午04时35分18秒 CST> <Error> <WebLogicServer> <BEA-000337> <ExecuteT
hread: '12' for queue: 'weblogic.kernel.Default' has been busy for "111" seconds
working on the request "Http Request: /guestAction.jsp", which is more than the
configured time (StuckThreadMaxTime) of "60" seconds.>
<2008-4-22 上午04时36分18秒 CST> <Error> <WebLogicServer> <BEA-000337> <ExecuteT
hread: '12' for queue: 'weblogic.kernel.Default' has been busy for "171" seconds
working on the request "Http Request: /guestAction.jsp", which is more than the
configured time (StuckThreadMaxTime) of "60" seconds.>
2、 判断可能存在部分sql语句未优化,造成执行时间过长(request超时)造成挂死
3、 解决
开发模式和产品模式的一些参数的默认值不同,可能会对性能造成影响,下面是对性能有影响的参数列表:
参数 开发模式默认值 产品模式默认值
Execute Queue: Thread Count 15 threads 25 threads
JDBC Connection Pool: MaxCapacity 15 connnections 25 connections
通过启动管理控制台,在域(如:mydomain)> 配置 > 常规选择产品模式。
修改了server-myserver参数中的threadcount参数,按照cpu数量,修改为100
修改jdbc数据库连接池,修改为初始15,最大100。
晚间进行跟踪,系统运行正常,高峰时段,尤其是早晨的高峰时段,系统没有再出现挂死的问题。
早晨点击页面查询发现有时会出现页面无法访问的情况。
跟踪发现weblogic最高时有100多并发,同时注意到内存占用比较高,检查发现,原来内存配置较低。
检查原配置文件:
:bea
if "%PRODUCTION_MODE%" == "true" goto
bea_prod_mode
set JAVA_VM=-jrockit
set MEM_ARGS=-Xms96m -Xmx256m
set
JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none
goto
continue
:bea_prod_mode
set JAVA_VM=-jrockit
set MEM_ARGS=-Xms128m
-Xmx256m
goto continue
:sun
if "%PRODUCTION_MODE%" == "true" goto sun_prod_mode
set
JAVA_VM=-client
set MEM_ARGS=-Xms32m -Xmx200m -XX:MaxPermSize=128m
set
JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none
goto
continue
:sun_prod_mode
set JAVA_VM=-server
set MEM_ARGS=-Xms32m
-Xmx200m -XX:MaxPermSize=128m
goto continue
很明显配置为96m,最高256m。修改后的参数:
修改后结果为
:bea
if "%PRODUCTION_MODE%" == "true" goto
bea_prod_mode
set JAVA_VM=-jrockit
set MEM_ARGS=-Xms256m -Xmx768m
set
JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none
goto
continue
:bea_prod_mode
set JAVA_VM=-jrockit
set MEM_ARGS=-Xms256m
-Xmx768m
goto continue
:sun
if "%PRODUCTION_MODE%" == "true" goto sun_prod_mode
set
JAVA_VM=-client
set MEM_ARGS=-Xms256m -Xmx768m -XX:MaxPermSize=128m
set
JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none
goto
continue
:sun_prod_mode
set JAVA_VM=-server
set MEM_ARGS=-Xms256m
-Xmx768m -XX:MaxPermSize=128m
goto continue
:continue
最低256,最高768.查看跟踪信息比较调整前后性能:
调整前内存
调整后情况:
现在垃圾回收不那么频繁了,整体稳定性应该有好处。再频繁打开一个页面的情况下,页面仍然能正常显示。