jmeter - 使用JMeter测试: how to run N requests per second

标签 jmeter load-testing performance-testing stress-testing

我需要测试我们的系统是否可以每秒执行 N 个请求。 从技术上讲,这是对一个 API 的 2 个请求,对另一个 API 的 2 个请求,以及对第三个 API 的 6 个请求。 但重要的是它们应该同时发生 - 所以每秒 10 个请求。 因此,在 JMeter 中我创建了三个线程组,首先定义线程数 1,启动时间 0。 第二个线程组相同,第三个线程组定义线程数 6 和启动时间 0。 但这并不能真正保证它会每秒运行它们 我该如何效仿呢?我如何查看结果——是否能够执行?

谢谢!

最佳答案

您可以使用ConstantThroughputTimer

引用以下 JMeter 帮助文件:

18.6.4 Constant Throughput Timer This timer introduces variable pauses, calculated to keep the total throughput (in terms of samples per minute) as close as possible to a give figure. Of course the throughput will be lower if the server is not capable of handling it, or if other timers or time-consuming test elements prevent it. N.B. although the Timer is called the Constant Throughput timer, the throughput value does not need to be constant. It can be defined in terms of a variable or function call, and the value can be changed during a test.

例如,我用它每秒生成 40 个请求:

 <ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="Constant Throughput Timer" enabled="true">
      <stringProp name="calcMode">all active threads in current thread group</stringProp>
      <doubleProp>
        <name>throughput</name>
        <value>2400.0</value>
        <savedValue>0.0</savedValue>
      </doubleProp>
    </ConstantThroughputTimer>

这就是总结:

Created the tree successfully using performance/search-performance.jmx
Starting the test @ Tue Mar 15 16:28:39 CET 2011 (1300202919244)
Waiting for possible shutdown message on port 4445
Generate Summary Results +  3247 in  80,3s =   40,4/s Avg:    18 Min:     0 Max:  1328 Err:   108 (3,33%)
Generate Summary Results +  7199 in 180,0s =   40,0/s Avg:    15 Min:     1 Max:  2071 Err:   378 (5,25%)
Generate Summary Results = 10446 in 260,3s =   40,1/s Avg:    16 Min:     0 Max:  2071 Err:   486 (4,65%)
Generate Summary Results +  7200 in 180,0s =   40,0/s Avg:    14 Min:     0 Max:   152 Err:   399 (5,54%)
Generate Summary Results = 17646 in 440,4s =   40,1/s Avg:    15 Min:     0 Max:  2071 Err:   885 (5,02%)
Generate Summary Results +  7199 in 180,0s =   40,0/s Avg:    14 Min:     0 Max:  1797 Err:   436 (6,06%)
Generate Summary Results = 24845 in 620,4s =   40,0/s Avg:    15 Min:     0 Max:  2071 Err:  1321 (5,32%)

但我在我的网络内运行此测试。

关于jmeter - 使用JMeter测试: how to run N requests per second,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5018846/

相关文章:

c# - 如何在 VS 2010 安装项目之前进行目标系统要求测试 c#

java - Jmeter jtl报告不打印异常错误

java - 在单个 SQL 语句中插入/更新/删除多个表

load-testing - 达到更多虚拟用户时 k6 显示的错误

jMeter:如何模拟多个并发用户使用不同的登录 id 登录

c# - 这是什么意思 "Detected time complexity: O(Y-X)"?

c++ - 避免使用内联 asm 优化 away 变量

Jmeter - 当 csv 值为空时跳过填充参数/值

JMeter Once Only Controller 最后

javascript - node.js "net"性能测试