且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jmeter运行结果与手动捕获的响应时间之间存在Jmeter响应时间差

更新时间:2023-08-18 12:04:58

JMeter可以根据每个请求捕获三个基本度量:

JMeter have three basic measurements it captures per request:

  • 经过时间(从开始发送请求到接收到最后一位的总时间)

  • Elapsed Time (which is overall timespan from the point when it just starts sending request to the last bit received)

延迟(在同一时间点开始,并在服务器开始响应时结束)

Latency (which starts the same point in time and ends when server starts responding)

连接时间(包括在延迟中,基本上是与服务器握手的时间,包括SSL/TLS协商)

And Connect time (which is included in latency and is basically the time for handshakes with server, including SSL/TLS negotiations)

因此,如果您在侦听器之间设置数据写入器(例如,SimpleDataWriter,尽管AggregateReport& SummaryReport也可以这样做),则您会在数据文件中看到这些指标(而标准的侦听器/可视化器/聚合器滞后时间).

So if you set a data writer among your listeners (e.g SimpleDataWriter, although AggregateReport & SummaryReport can do it as well), you'll see these metrics in your data file (while standard listeners/visualisers/aggregators stuck to elapsed time only).

但是请注意,这些指标不包括响应呈现,尤其是浏览器要执行的任何代码.

But mind that these metrics doesn't include response rendering, and especially any code to be executed by browser.

JMeter根本不做任何事情:显然,它仅衡量Server + Network的综合性能,跳过客户端的所有操作(除了最基本的要求,例如协议协商).

JMeter just doesn't do it at all: obviously, it measures just the combined performance of Server + Network, skipping everything on the client side (except for bare necessities, like protocol negotiations).

这也许可以解释您所经历的差异.

That might explain the difference you've experienced.

以及记录的服务器处理时间之间的差异& JMeter测量的响应时间:服务器只是不计算网络带来的收益.

As well as the difference between logged server processing times & the response times measured by JMeter: server just doesn't count what the network brings in.

PS而且您不必坐在浏览器上点击秒表:现代的秒表具有开发工具,能够为您显示经过各个阶段划分的精确计时.例如,只需在Chrome中调用Ctrl + Shift + I,然后切换到网络标签&在您进行请求时,可以看到那里的时间安排.

PS And you don't have to sit and click on stopwatch with your browser: modern ones have a Dev Tools capable of showing you the precision timings divided by stages. E.g., just call Ctrl+Shift+I in Chrome, switch to network tab & behold the timings right there as you doing your requests.