Jmeter如何查看响应耗时的分解情况

2020/12/08 10:54
阅读数 3.1K

熟悉Loadrunner的同学,应该或多或少都见过或用过lr Analysis的web page diagnostics功能,从这个功能我们可以知道某个耗时较长的事务中:

  1. 每个请求的耗时情况,以及哪个请求是耗时最长的?
  2. 每个请求的耗时分布情况,包括DNS解析、网络连接、服务端响应、接收等环节的耗时情况,对于性能问题的定位能起到一定的参考作用。

见下图
Jmeter如何查看响应耗时的分解情况

那么,Jmeter是否有类似的功能呢?答案是有的,而且很容易就知道了,只是平时关注的不多可能会没留意到。
举两个地方:

  1. 通过no gui 启动(jmeter -n -t script.jmx -l result.csv),result.csv中就能看到这个数据;
  2. 通过gui启动的,在Listener--View Results in Table 中就能看到;
    Jmeter如何查看响应耗时的分解情况

比如,上图我们可以看出某些响应比较慢的请求,是由于connect慢造成的,这样有助于我们明确下一步需要细化监控定位的问题方向。

关于Elapsed time、Latency、Connect Time的解释如下:
Elapsed time. JMeter measures the elapsed time from just before sending the request to just after the last response has been received. JMeter does not include the time needed to render the response, nor does JMeter process any client code, for example Javascript.

Elapsed time :从发送请求到收到最后的响应时间,所花费的时间。不包括渲染请求所花费的时间,同时也不包括处理客户端脚本所花费的时间。

Latency. JMeter measures the latency from just before sending the request to just after the first response has been received. Thus the time includes all the processing needed to assemble the request as well as assembling the first part of the response, which in general will be longer than one byte. Protocol analysers (such as Wireshark) measure the time when bytes are actually sent/received over the interface. The JMeter time should be closer to that which is experienced by a browser or other application client.

Latency:从发送请求到收到第一个响应,所花费的时间。网上还有种说法,就是响应信息越大,差别越大。

Connect Time. JMeter measures the time it took to establish the connection, including SSL handshake. Note that connect time is not automatically subtracted from latency. In case of connection error, the metric will be equal to the time it took to face the error, for example in case of Timeout, it should be equal to connection timeout.

Connect Time:建立连接所花费的时间。包括SSL三次握手的时间。值的注意的latency没有减去建立连接花费的时间,当出现链接超时等错误,这个会等于链接超时时间。

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部