Reputation: 337
Im currently trying to Ramp-Up threads on a random timer but could not find a satisfying solution so far. I want to start a new thread every 4 to 12 (Random) Seconds.
Is it somehow possible to Ramp up threads based on a groovy script?
I tried using "${__Random(4,12)}" inside the Threads scheduling Parameters of the Stepping Thread Group but this is only executed once resulting in starting all the threads with the same time increment
Upvotes: 0
Views: 161
Reputation: 168082
I don't think you should be going into that direction because tests need to be repeatable hence using random delays in ramp-up is not something you should be normally doing.
If despite the above warning you still want to implement it I would recommend considering using a 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 there but make sure to convert seconds to milliseconds like ${__Random(4000,12000,)}
If you need to delay the thread start event for the random amount of time I'm afraid that this is not possible using either existing 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
ctx.getThreadGroup().addNewThread(org.apache.commons.lang3.RandomUtils.nextInt(4000, 12000), ctx.getEngine())
Upvotes: 1