Jmeter Summariser report及其可视化

Jmeter在做性能测试的时候,可能会run很长时间,这样产生的log会非常大,跑过一次72小时的测试,log达到了6G!,这样分析起来会比较麻烦,JMeter还提供了summariser result report,就是在每隔一段时间打一行log,这样log就会大大减小。

Jmeter summariser report的设置在:bin/jmeter.properties.

#---------------------------------------------------------------------------
# Summariser - Generate Summary Results - configuration (mainly applies to non-GUI mode)
#---------------------------------------------------------------------------
#
# Define the following property to automatically start a summariser with that name
# (applies to non-GUI mode only)
summariser.name=summary
#
# interval between summaries (in seconds) default 3 minutes
summariser.interval=180
#
# Write messages to log file
summariser.log=true
#
# Write messages to System.out
#summariser.out=true

以上设置每隔3分钟向jmeter.log中写入一行log


# Combined log file (for jmeter and jorphan)
log_file=jmeter.log

log的格式如下:

Creating summariser <summary>
Created the tree successfully using /opt/JMeter/TestPlan/test.jmx
Starting the test @ Tue Jun 25 16:22:12 CST 2013 (1372148532713)
Waiting for possible shutdown message on port 4445
summary +   2075 in   107s =   19.4/s Avg:    51 Min:    12 Max:  2318 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary +   3753 in   180s =   20.8/s Avg:    47 Min:    12 Max:   849 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary =   5828 in   287s =   20.3/s Avg:    49 Min:    12 Max:  2318 Err:     0 (0.00%)
summary +   3864 in   180s =   21.4/s Avg:    46 Min:    11 Max:   634 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary =   9692 in   467s =   20.7/s Avg:    48 Min:    11 Max:  2318 Err:     0 (0.00%)
summary +   3847 in   180s =   21.4/s Avg:    46 Min:    11 Max:   697 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary =  13539 in   647s =   20.9/s Avg:    47 Min:    11 Max:  2318 Err:     0 (0.00%)

summary +是这三分钟的数据,summary =是累计到当前时刻所有的数据

以第三行数据为例,5828是发出的请求数目,287s是时间, 20.3是每秒发出的请求,即吞吐量,Avg, Min, Max分别是平均响应时间,最小响应时间和最大响应时间,响应时间指的是从请求发出到收到响应的时间,Err后面跟的数据分别是错误数和错误比例。

对于summariser报告,可以通过写一个简单的脚本来解析并作图形化展示,下面是用python写的一个简单脚本,可以画平均时延和吞吐量,使用方法是

python summary.py test.log,下面是summary.py内容:

import matplotlib.pyplot as plt
import re
import sys

avgtime_data=[]
mintime_data=[]
maxtime_data=[]
throughput_data=[]

logfile=open(sys.argv[1])
try:
    while True:
		line=logfile.readline()
		if line=='':
			break
		if line.startswith('summary ='):
			result=re.split(r'\s+', line)
			avgtime_data.append(result[8])
			throughput=result[6]
			throughputvalue=throughput[:-2]
			throughput_data.append(throughputvalue)
finally:
    logfile.close()

plt.figure(figsize=(8,4))
plt.ylim(0,60)
plt.plot(avgtime_data,color="red",label="Avg ResponseTime (milliseconds)")
plt.plot(throughput_data,color="green",label="ThroughPut (/s)")
frame = plt.gca()
frame.axes.xaxis.set_ticklabels([])
plt.xlabel("Duration, 2013/06/25 16:30:00 -- 2013/06/28 6:00:00, about 60 hours")
plt.title("sundong Jmeter Test Report")
plt.legend()
plt.show()


  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值