Jmeter 随机加速

Jmeter Random Ramp-up

我目前正在尝试在随机计时器上增加线程,但到目前为止找不到令人满意的解决方案。我想每 4 到 12(随机)秒启动一个新线程。

是否有可能基于 groovy 脚本增加线程?

我尝试在步进线程组的线程调度参数中使用“${__Random(4,12)}”,但这只执行一次导致以相同的时间增量启动所有线程

我认为你不应该朝那个方向发展,因为测试需要 repeatable 因此在 ramp-up 中使用随机延迟不是你通常应该做的事情。

如果尽管有上述警告你仍然想实现它,我建议考虑在那里使用 Constant Timer, if you put it as a child of the first request it will introduce a delay before this request and you will be able to use __Random() function 但确保将秒转换为毫秒,如 ${__Random(4000,12000,)}

如果您需要将 thread start 事件延迟随机时间,恐怕使用现有的 Thread Group or Custom Thread Groups so you will either need to implement your own thread group by creating a new JMeter Plugin or alternatively you can kick off new JMeter threads from JSR223 Sampler like[= 是不可能的15=]

ctx.getThreadGroup().addNewThread(org.apache.commons.lang3.RandomUtils.nextInt(4000, 12000), ctx.getEngine())