9

我是 Jmeter 的新手,对这 4 个设置感到困惑:

  • 线程数,
  • 加速期,
  • 循环计数,
  • 调度程序中的持续时间。

    Thread Group 1: # of threads:1, ramp up period:0, loop count:5, no scheduler
    Thread Group 2: # of threads:5, ramp up period:0, loop count:1, no scheduler
    Thread Group 3: # of threads:1, ramp up period:1s, loop count:5, no scheduler
    Thread Group 4: # of threads:5, ramp up period:5s, loop count:1, no scheduler
    Thread Group 5: # of threads:1, ramp up period:1s, loop count:forever, duration in scheduler:5s
    Thread Group 6: # of threads:5, ramp up period:5s, loop count:forever, duration in scheduler:5s
    
    1. 线程组 1 和 2 之间有什么区别吗?
    2. 每个循环之间的时间上限是多长时间?
    3. 线程组 3、4、5 和 6 之间有什么区别吗?
    4. 第 3、4、5 和 6 组是否都需要 5 秒才能完成所有请求的发送?每组的结果总数是否应该为 5?
    5. 当我尝试线程组 5 时,我得到了大约 83 个响应,为什么不是只有 5 个响应?这是否意味着加速期不起作用?

我对这些群体之间的差异感到非常困惑,希望有人能帮助我。提前非常感谢!

4

2 回答 2

10

首先,每个参数的简短定义:

  1. 线程数:模拟用户数

  2. Ramp up period :Jmeter 启动所有线程所需的时间

  3. 循环计数:每个线程执行测试用例的次数

  4. 调度程序中的持续时间:运行测试的持续时间。在这种情况下,结束时间字段中的值应被忽略,相对结束时间将根据开始时间和持续时间计算

这里要理解的重要一点是,加速期与循环计数无关。它仅与线程数有关。如果有 10 个线程且加速时间为 100 秒,则每个线程将在前一个线程启动后 10 秒开始,总共需要 100 秒来启动线程组中的所有线程。

现在每个线程组案例的答案:

Thread Group 1: # of threads:1, ramp up period:0, loop count:5, no scheduler
Thread Group 2: # of threads:5, ramp up period:0, loop count:1, no scheduler
Thread Group 3: # of threads:1, ramp up period:1s, loop count:5, no scheduler
Thread Group 4: # of threads:5, ramp up period:5s, loop count:1, no scheduler
Thread Group 5: # of threads:1, ramp up period:1s, loop count:forever, duration in scheduler:5s
Thread Group 6: # of threads:5, ramp up period:5s, loop count:forever, duration in scheduler:5s

Q1。线程组 1 和 2 之间有什么区别吗?

线程组 1 有一个线程,它将重复相同的测试 5 次,即当一个测试完成时重复测试,直到循环计数达到 5

线程组 2 有 5 个线程将同时启动,因为 Ramp-up Period 为 0,因此它将在系统上同时模拟 5 个用户

Q2。每个循环之间的时间上限是多长时间?

时间上限是加速周期的一个因素,它在线程组中的线程数之间平均分配。循环是一个连续的过程,将一直持续到达到循环计数。“时间上限”不是 JMeter 文档中使用的术语,但假设您的意思是,如果您需要细粒度控制,可以使用测试操作或其他 JMeter 机制在循环之间设置它。

Q3。线程组 3、4、5 和 6 之间有什么区别吗?

是的,所有的参数都是不同的,所以如上所述,行为是不同的。

Q4。第 3、4、5 和 6 组是否都需要 5 秒才能完成所有请求的发送?每组的结果总数是否应该为 5?

不,这对每个条件都是主观的。在线程组 3 中,单个线程应执行同一线程 5 次,因此无法控制时间

在线程组 4 中,有 5 个线程,并且基于加速周期,每个线程应在 1 秒后启动,因此至少需要 4-5 秒才能完成测试(在最后一次测试之后)

线程组 5 和 6 应仅运行 5 秒的持续时间。如果在此之前完成测试,则可以,否则将终止并停止测试

Q5。当我尝试线程组 5 时,我得到了大约 83 个响应,为什么不是只有 5 个响应?这是否意味着加速期不起作用?

为什么只有5个响应???线程组 5 将创建一个线程,该线程将永远执行循环中的测试。如果未定义持续时间,则测试将在无限循环中运行。由于定义了持续时间,因此测试应仅在持续时间段内运行。

所有人注意:循环计数是线程特定的。它指定应为每个线程重复测试的次数。加速周期与#Thread(用户)有关,与循环计数无关

于 2013-12-13T10:15:43.850 回答
3
  1. 是的,1 模拟一个用户在 Thread Group1 内执行 5 次测试场景,2,模拟 5 个用户执行 1 次测试场景
  2. 如果您不使用任何计时器,就没有时间
  3. 是的,3 和线程组 1 一样,4 和线程组 2 一样,但是用户是在 1 秒之后启动的,5 和线程组 1 一样但是运行了 5 秒,所以你不知道它会执行多少次。6 与线程组 2 相同,但运行时间为 5 秒
  4. 5 和 6 将运行 5 秒,3 和 4 将按照 3 中的说明运行。否 5.因为它运行 5 秒而没有任何暂停,因为您没有设置任何计时器。由于您只有一个线程,它会立即启动并运行 5 秒。

读:

于 2013-05-10T19:05:17.520 回答