最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jmeter - Active Threads Over Time vs. number of threads (users) - Stack Overflow

programmeradmin3浏览0评论

I've got the following Thread Group description with 120 Users, a Ramp up time of 60 Seconds and the test should run (additionally?) 120 Seconds.

After running the test, I wanted to see my active threads over time. I would expect to have 120 threads after 60 seconds. However I get the following graph:

What did I misunderstand?

I've got the following Thread Group description with 120 Users, a Ramp up time of 60 Seconds and the test should run (additionally?) 120 Seconds.

After running the test, I wanted to see my active threads over time. I would expect to have 120 threads after 60 seconds. However I get the following graph:

What did I misunderstand?

Share Improve this question edited Jan 19 at 10:01 jonrsharpe 122k30 gold badges266 silver badges473 bronze badges asked Jan 19 at 9:54 KleifkerKleifker 255 bronze badges 0
Add a comment  | 

2 Answers 2

Reset to default 1

We need to keep all threads busy during the test by setting <intProp name="LoopController.loops">-1</intProp>

Complete ThreadGroup with ramp_time = 20

      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <intProp name="LoopController.loops">-1</intProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">120</stringProp>
        <stringProp name="ThreadGroup.ramp_time">20</stringProp>
        <boolProp name="ThreadGroup.scheduler">true</boolProp>
        <stringProp name="ThreadGroup.duration">120</stringProp>
        <stringProp name="ThreadGroup.delay">1</stringProp>
        <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
        <boolProp name="ThreadGroup.delayedStart">true</boolProp>
      </ThreadGroup>

Example output when running test in non-GUI mode, which is recommended: jmeter -n -t testplan.jmx -l results.jtl. As we see, after rampup, all 120 threads are busy.

Creating summariser <summary>
Created the tree successfully using testplan.jmx
Starting standalone test @ 2025 Jan 19 11:43:26 CET (1737283406619)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary +      1 in 00:00:04 =    0.2/s Avg:   239 Min:   239 Max:   239 Err:     0 (0.00%) Active: 20 Started: 20 Finished: 0
summary +    822 in 00:00:29 =   28.2/s Avg:    18 Min:     8 Max:   252 Err:     0 (0.00%) Active: 120 Started: 120 Finished: 0
summary =    823 in 00:00:33 =   24.7/s Avg:    19 Min:     8 Max:   252 Err:     0 (0.00%)
summary +   1171 in 00:00:30 =   39.1/s Avg:    23 Min:     5 Max:   853 Err:   237 (20.24%) Active: 120 Started: 120 Finished: 0
summary =   1994 in 00:01:03 =   31.5/s Avg:    21 Min:     5 Max:   853 Err:   237 (11.89%)
summary +   1186 in 00:00:30 =   39.5/s Avg:    14 Min:     3 Max:    68 Err:   169 (14.25%) Active: 120 Started: 120 Finished: 0
summary =   3180 in 00:01:33 =   34.0/s Avg:    19 Min:     3 Max:   853 Err:   406 (12.77%)
summary +   1114 in 00:00:28 =   40.4/s Avg:    13 Min:     4 Max:    80 Err:   121 (10.86%) Active: 0 Started: 120 Finished: 120
summary =   4294 in 00:02:01 =   35.5/s Avg:    17 Min:     3 Max:   853 Err:   527 (12.27%)
Tidying up ...    @ 2025 Jan 19 11:45:27 CET (1737283527656)
... end of run

When running test with e.g. <intProp name="LoopController.loops">1</intProp>, each thread will quit after 1 sample.

You have 120 loops, not 120 seconds, and the duration of post-ramp-up phase will depend on the number of requests and the system under test response time.

In order to achieve your workload model you need to set the number of loops to -1 or tick Infinite box and set duration to 180 seconds (ramp-up + 120 seconds)

More information:

  • Elements of Test Plan -> Thread Group
  • JMeter Ramp Up Period: The Ultimate Guide
发布评论

评论列表(0)

  1. 暂无评论