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分别是平均响应时间,最小响应时间和最大响应时间,响应时间指的是从请求发出到收到响应的时间,单位是ms,
Err后面跟的数据分别是错误数和错误比例。
对于summariser报告,可以通过写一个简单的脚本来解析并作图形化展示,下面是用Python写的一个简单脚本,可以画平均时延和吞吐量,使用方法是
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()
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 filesummariser.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
http://blog.csdn.net/just_lion/article/details/9209253