Welcome

首页 / 软件开发 / 数据结构与算法 / 经验分享:内存泄漏的性能测试

经验分享:内存泄漏的性能测试2011-02-27 51testing 假装不在问题:

性能测试过程中,10个用户并发持续运行几分钟后,服务器停止响应。

从LR的错误来看,有下面几种:

1)Error -27728: Step download timeout (120 seconds) has expired when downloading non-resource(s)

2)Error -27791: Server "appsvr01" has shut down the connection prematurely [MsgId: MERR-27791]

3)Error -27796: Failed to connect to server "appsvr01:38080": [10061] Connection refused

4)Error -26372: ContentCheck Rule "stackTrace" in Application "BIOffice" triggered. Text "","stackTrace":"" matched (count=1) [MsgId: MERR-26372]

但后两种应该是由前面两种错误引起的间接错误。从出错顺序上看,是先出现前面的超时错误,最后整个服务器都停止响应了。

定位:

1)用客户端连接该服务器,没有响应;

2)Netstat看到服务器端口还在侦听,但telnet该端口被强制断开了,说明WebServer已经不正常了;

3)从服务器的log看到有OutOfMemory的错误,判断是和内存泄漏有关。

重现及分析:

1)设置-verbose:gc -Xloggc:./gc.log 打印gc日志,重新运行脚本,重现该问题。

从gc日志中看到开始运行时,每隔一段时间会进行垃圾回收,不过内存堆栈的使用还是越来越大,最后内存不够用,频繁做Full GC引起服务器停止响应。