为什么线程数增长高于预期?

时间:2017-06-02 08:16:29

标签: jmeter jmeter-plugins

我有一个只有一个HTTP请求的测试用例。线程数和Ramp Up周期设置为30.我计划进行600秒的测试。enter image description here

但是看看JMeter输出,我可以看到生成大量请求。为什么会这样?我期待一分钟内只生成60个线程。有人可以建议我怎么做吗?

S:\roshTests\apache-jmeter-3.1\bin>jmeter -n -t 
S:\roshTests\LivePerformance\June1\PPS-Proxy\catalog\catalog.jmx  -l 
S:\roshTests\LivePerformance\June1\PPS-Proxy\catalog\Output\results.csv
Writing log file to: S:\roshTests\apache-jmeter-3.1\bin\jmeter.log
Creating summariser <summary>
Created the tree successfully using S:\roshTests\LivePerformance\June1\PPS-Proxy\catalog\catalog.jmx
Starting the test @ Fri Jun 02 05:18:04 IDT 2017 (1496369884546)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary +    377 in 00:00:25 =   15.3/s Avg:   766 Min:   106 Max:  3114 Err:   198 (52.52%) Active: 25 Started: 25 Finished: 0
summary +   1364 in 00:00:30 =   45.5/s Avg:   647 Min:   144 Max:  4385 Err:  1180 (86.51%) Active: 30 Started: 30 Finished: 0
summary =   1741 in 00:00:55 =   31.9/s Avg:   673 Min:   106 Max:  4385 Err:  1378 (79.15%)
summary +    985 in 00:00:30 =   32.8/s Avg:   643 Min:    88 Max:  4918 Err:   752 (76.35%) Active: 30 Started: 30 Finished: 0
summary =  12859 in 00:05:25 =   39.6/s Avg:   616 Min:    88 Max:  6149 Err: 10562 (82.14%)
summary +    984 in 00:00:30 =   32.8/s Avg:   675 Min:   113 Max:  5070 Err:   762 (77.44%) Active: 30 Started: 30 Finished: 0
summary =  11874 in 00:04:55 =   40.3/s Avg:   614 Min:   100 Max:  6149 Err:  9810 (82.62%)
summary +   1103 in 00:00:30 =   36.7/s Avg:   624 Min:   104 Max:  4935 Err:   884 (80.15%) Active: 30 Started: 30 Finished: 0
summary =  10890 in 00:04:25 =   41.2/s Avg:   609 Min:   100 Max:  6149 Err:  9048 (83.09%)
summary +   1220 in 00:00:30 =   40.6/s Avg:   584 Min:   100 Max:  6149 Err:  1001 (82.05%) Active: 30 Started: 30 Finished: 0
summary =   9787 in 00:03:55 =   41.7/s Avg:   607 Min:   100 Max:  6149 Err:  8164 (83.42%)
summary +   1336 in 00:00:30 =   44.5/s Avg:   570 Min:   106 Max:  5296 Err:  1106 (82.78%) Active: 30 Started: 30 Finished: 0
summary =   8567 in 00:03:25 =   41.9/s Avg:   610 Min:   106 Max:  5643 Err:  7163 (83.61%)
summary +   1320 in 00:00:30 =   44.0/s Avg:   587 Min:   116 Max:  5187 Err:  1111 (84.17%) Active: 30 Started: 30 Finished: 0
summary =   7231 in 00:02:55 =   41.4/s Avg:   618 Min:   106 Max:  5643 Err:  6057 (83.76%)
summary +   1273 in 00:00:30 =   42.5/s Avg:   637 Min:   106 Max:  5383 Err:  1072 (84.21%) Active: 30 Started: 30 Finished: 0
summary =   5911 in 00:02:25 =   40.9/s Avg:   625 Min:   106 Max:  5643 Err:  4946 (83.67%)
summary +   1430 in 00:00:30 =   47.6/s Avg:   591 Min:   116 Max:  5643 Err:  1229 (85.94%) Active: 30 Started: 30 Finished: 0
summary =   4638 in 00:01:55 =   40.5/s Avg:   621 Min:   106 Max:  5643 Err:  3874 (83.53%)
summary +   1467 in 00:00:30 =   48.9/s Avg:   589 Min:   119 Max:  4691 Err:  1267 (86.37%) Active: 30 Started: 30 Finished: 0
summary =   3208 in 00:01:25 =   37.9/s Avg:   635 Min:   106 Max:  4691 Err:  2645 (82.45%)
summary +   1070 in 00:00:30 =   35.7/s Avg:   651 Min:    99 Max:  7324 Err:   862 (80.56%) Active: 30 Started: 30 Finished: 0
summary =  13929 in 00:05:55 =   39.3/s Avg:   619 Min:    88 Max:  7324 Err: 11424 (82.02%)
summary +   1531 in 00:00:30 =   51.1/s Avg:   594 Min:   106 Max:  5194 Err:  1332 (87.00%) Active: 30 Started: 30 Finished: 0
summary =  15460 in 00:06:25 =   40.2/s Avg:   617 Min:    88 Max:  7324 Err: 12756 (82.51%)

3 个答案:

答案 0 :(得分:1)

我不确定你是否理解线程和请求之间的区别。线程数量不等于请求,您在输出中看到的是线程发出的请求数量,并且根据您的响应时间,很有可能获得那么多结果。

尝试将循环计数设置为1或2,您将看到请求将与您的计算结果一致。

除此之外......在最右侧的输出中,您可以看到启动了多少个线程。

答案 1 :(得分:0)

使用当前设置,线程将以一秒延迟启动。

加速期是所有踏板应该开始的时间。

你将循环设置为无限,所以当所有线程在最初的30秒后登录时,你将始终拥有30个活跃用户,并且永远不会有更多这样的用户。

根据服务器的响应时间,您还有更多请求,但线程就像用户一样。如果设置为30,则始终为30.: - )

答案 2 :(得分:0)

您正在运行30个虚拟用户10分钟。每个虚拟用户都在尽可能快地执行samplers (速度主要取决于您的应用程序响应时间)这就是您有很多请求的原因。

如果您需要将JMeter吞吐量限制为每秒60个请求,则只能使用Constant Throughput Timer来执行此操作:

  1. 将恒定吞吐量计时器添加到测试计划
  2. 设定&#34;目标吞吐量&#34;到60
  3. 根据&#34;设置&#34;计算吞吐量;到All active threads
  4. 这样JMeter将会暂停&#34;它的线程(虚拟用户)将它们降低到每分钟60个请求。