JMeter 中的如何区分 Server Time 和 Network Time

在 LR 中是有一个“网页细分图”的,通过这个图,你可以比较容易的区分哪些请求的响应时间最长,如果响应时间过程,是消耗在server处理的时候,还是消耗在网络传输过程中——也就是所谓的 Server time 和 Network time。
JMeter 并没有提供这么详细的区分——至少目前尚未发现,但是在 JMeter 的执行结果中也有一个字段可以利用一下。如果想看到这一项,首先要设置将 JMeter 运行结果保存到 XML 格式。

JMeter.properties 中找到
JMeter.save.saveservice.output_format=csv   改为
JMeter.save.saveservice.output_format=xml

重新启动 JMeter ,执行一个脚本并保存测试结果。
使用任何一个文本编辑工具打开 .jtl 文件,内容如下:

 1  <? xml version="1.0" encoding="UTF-8" ?>
 2  < testResults  version ="1.2" >
 3  < httpSample  t ="2969"  lt ="1906"  ts ="1159349557390"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-1"  dt ="text"  ng ="5"  na ="5" />
 4  < httpSample  t ="2797"  lt ="1719"  ts ="1159349557609"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-2"  dt ="text"  ng ="5"  na ="5" />
 5  < httpSample  t ="2625"  lt ="1594"  ts ="1159349558015"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-4"  dt ="text"  ng ="5"  na ="5" />
 6  < httpSample  t ="2843"  lt ="1812"  ts ="1159349557812"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-3"  dt ="text"  ng ="5"  na ="5" />
 7  < httpSample  t ="2687"  lt ="1110"  ts ="1159349558218"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-5"  dt ="text"  ng ="5"  na ="5" />
 8  < httpSample  t ="844"  lt ="391"  ts ="1159349560374"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-1"  dt ="text"  ng ="5"  na ="5" />
 9  < httpSample  t ="843"  lt ="437"  ts ="1159349560406"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-2"  dt ="text"  ng ="4"  na ="4" />
10  < httpSample  t ="781"  lt ="422"  ts ="1159349560640"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-4"  dt ="text"  ng ="3"  na ="3" />
11  < httpSample  t ="782"  lt ="391"  ts ="1159349560905"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-5"  dt ="text"  ng ="2"  na ="2" />
12  < httpSample  t ="1188"  lt ="485"  ts ="1159349560655"  s ="true"  lb ="http://jackei.cnblogs.com/"  rc ="200"  rm ="OK"  tn ="Thread Group 1-3"  dt ="text"  ng ="1"  na ="1" />
13 
14  </ testResults >
15 

找到 lt 这一项。

结合 JMeter 的几篇文章和 email,解释一下 lt 的意思。
lt = latency time (ms)

JMeter 中执行一个脚本时,大概的过程如下:

Start timer
Send Request
Wait for data
Initial (first) response packet occurs - this is latency
more data
...
end of response
Stop timer - this is the response time


这里可以看到 lt 是接收到响应的第一个包的时间。
而上面的 XML 文件中,t 这一项表示的是 elapsed time。也就是一个请求从发出到收到完整的响应的时间。
那么 lt 就相当于 LR 中的 Server time,而 t-lt 就相当于 LR 中的 Netwrok time。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值