吞吐量和响应时间如何相关

How Throughput and Response time are related

我运行 JMeter 测试 193 个样本 我可以看到我的平均响应时间为 5915 毫秒,吞吐量为 1.19832。

我只想知道它们到底有什么关系

TL;DR

没有,但是有。

两者没有直接关系,但是当增加吞吐量时,由于服务器上的load/stress,它可能会影响服务器响应时间。

如果出现超时错误,响应时间可能会增加。

但对于验证或防火墙错误 - 响应时间可能会减少。

JMeter archive里有很长的解释,最后是用迪士尼来演示:

Think of your last trip to disney or your favorite amusement park. Lets define capacity of the ride to be the number of people that can sit on the ride per turn (think roller coaster). Throughput will be the number of people that exit the ride per unit of time. Lets define service time the the amount of time you get to sit on the ride. Lets define response time or latency to be your time queuing for the ride (dead time) plus service time.

Respose Time : 从用户发送请求到请求完成计算的时间。

吞吐量:服务器属性在一定时间内可以进行的交易或请求的数量。这里 1.19832 /minute 表示服务器每分钟处理 1.19832 个样本。

随着响应时间的增加吞吐量增加。

所有答案都在JMeter Glossary

Elapsed time. JMeter measures the elapsed time from just before sending the request to just after the last response has been received.

Throughput is calculated as requests/unit of time. The time is calculated from the start of the first sample to the end of the last sample. This includes any intervals between samples, as it is supposed to represent the load on the server. The formula is: Throughput = (number of requests) / (total time).

关系是:响应时间长 - 吞吐量低,反之亦然。

您可以使用 Transactions per Second for throughput and Response Times Over Time for response times to get them plotted on your test timeline and Composite Graph 之类的图表将它们放在一起。这样您就可以跟踪趋势。

所有 3 个图表都可以使用 JMeter Plugins Manager

安装

在 load/Performance 测试方面。吞吐量和响应时间成反比。 IE 随着响应时间的增加,吞吐量应该会减少。 随着吞吐量的增加,响应时间应该会减少。

您可以在此博客中获得更详细的定义:

https://nirajrules.wordpress.com/2009/09/17/measuring-performance-response-vs-latency-vs-throughput-vs-load-vs-scalability-vs-stress-vs-robustness/

吞吐量有所增加,当所有资源都变得繁忙时,吞吐量保持稳定。现在,如果此时用户请求进一步增加,响应时间将会增加。但是,如果响应时间增加只是因为内部排队,那么由于系统同时接收更多请求,响应时间也在增加,吞吐量不会改变。当队列已满时,更多的请求应该会失败。如果响应增加是由于处理或服务请求的一些延迟,例如 运行 对数据库的查询,那么由于系统不接受更多请求并且同时响应时间也在增加,因此整个会下降。 只是一般性的解释。