Elearning性能测试总结报告
一、 项目情况
|
项目名称 |
Elearning |
|
调优过程 |
定位出应用程序存在非线程安全代码
DBA 定位到未加绑定变量的SQL以及为数据库增加索引
增加jboss ajp connector 线程数
调整jvm 参数
调整DBCP 连接池参数
调高 log4j日志阀值减少IO
|
|
|
|
|
问题积累 |
在已经满足性能情况下, 服务器硬件充足,但web server层错误频率高
|
|
最终结论 |
耗费在增加http header、定位非线程安全以及dbcp连接参数不当时间最昂贵。本次性能测试与调优涉及多个层面,定位性能瓶颈依赖平常的知识积累,只要拆分模块得当,定位瓶颈有模式可以遵循。为了排查瓶颈是否在数据库要DBA协助。
另外,碰到问题,google是一流的帮手!
|
|
资源消耗 |
历时2周 |
二、 执行中问题与解决方案
I类问题(已解决):
|
编号 |
问题描述 |
解决方法 |
|
1 |
手工执行功能成功,但vugen执行脚本服务器响应返回0字节 |
利用嗅探器ethereal发现手工执行与vugen执行脚本的差异,增加web_add_auto_header("modeltype","model");
解决问题后,经咨询东软开发工程师,服务器端解析输入代码有
if ("model".equals(webRequest.getHeader("ModelType")))
判断
|
|
2 |
Contoller Insufficient records for param X in table to provide the Vuser with unique data |
删除根盘目录 Local Settings/Temp下文件,排除干扰 |
|
3 |
并发执行时,发现服务器随机错误,确认有非线程安全代码 |
在客户端、服务器端分别用嗅探器(fiddler , ethereal, tcpdump )确认发包、收包的状况,确认发包正确,服务器HttpRequest接收到的包也正确。故程序出现在内部变量未做到线程同步
|
|
4 |
Apache error_log : [error] server reached MaxClients setting, consider raising the MaxClients setting
|
在httpd.conf增加:
StartServers 10
MinSpareServers 10
MaxSpareServers 15
ServerLimit 3000
MaxClients 2000
MaxRequestsPerChild 10000
KeepAliveTimeout 30
并重启httpd服务
|
|
5 |
java.lang.OutOfMemoryError: PermGen space、
java.lang.OutOfMemoryError: unable to create new native
|
调整JVM,增加堆、栈控制等参数。最终
Run.conf:
JAVA_OPTS="-Xms1536m -Xmx1536m -XX:PermSize=512m -XX:MaxPermSize=512m -Xss256k -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
|
|
6 |
jboss server.log有All threads (200) are currently busy, waiting. Increase maxThreads (200) or check the servlet status
|
Apache通过mod_jk1.2 转发http 请求给jboss。
故修改 jboss-4.0.5.GA/server/default/deploy/server.xml
调整ajp connector 设置:
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="${jboss.bind.address}" backlog="1200"
maxThreads="2100" minSpareThreads="20" maxSpareThreads="50"
emptySessionPath="true" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3"/>
同时在linux 的.bash_profile 增加文件句柄: ulimit -n 4096
|
|
7 |
ORA-00020: maximum number of processes (600) exceeded |
利用oracle statspack以及检查wait event,没有发现数据库方面有阻塞!故定位到连接池参数配置不当导致异常。
更改apache dbcp连接池参数,防止连接leak 。
<set property="removeAbandoned" value="true"/>
<set property="removeAbandonedTimeout" value="60"/>
<set property="logAbandoned" value="true"/>
|
|
8 |
调整log4j 日志级别 |
在jboss-4.0.5.GA/server/default/conf/log4j.xml
增加日志输出阀值:
<param value="ERROR"/> |
II类问题(未解决):
III类问题(遗留):
|
编号 |
问题描述 |
遗留原因 |
|
1 |
在已经满足性能情况下, 服务器硬件充足,但web server层应用代码大量错误
|
已经满足性能。建议采用tptp 、jprofiler或者JRockit Mission Control 之类工具定位热点方法 |
|
|
|
|
三、 技术拓展
调优用到的资料参考:
1 Apache Tomcat Configuration Reference http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html
2 OutOfMemoryExceptionWhenRedeploying http://wiki.jboss.org/wiki/Wiki.jsp?page=OutOfMemoryExceptionWhenRedeploying
3 Preventing dB connection pool leaks
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
4 Apache Performance Tuning
http://httpd.apache.org/docs/2.0/misc/perf-tuning.html
5 Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
所有评论(0)