Home > Software engineering >  Jmeter thread time series with milliseconds frequency
Jmeter thread time series with milliseconds frequency

Time:07-18

I am trying to build a test plan in JMeter based on a specific thread time series. For example, I know that at time x, there are n(x) users, and at time x t, there are n(x t) users, and so on. The issue is that the number of users has to be updated for t ~= 500ms, and the thread number is in a range of 20 - 200. Also, ideally, I would like to add and remove threads for the next time slot from the active threads instead of building new threads every time to save resources. I was trying different tricks to simulate this scenario:

  • Using execution of Thread Groups sequentially, you can set the duration lifetime but in seconds, every thread will be killed after the specific time slot and recreated in the following thread group.
  • Using the ultimate thread group, you can define your series of threads for each time interval but still in seconds, and it goes to generate new threads for each timeslot.

In both cases, if you fill the duration box with a value of 0.5, it seems not to recognize it or not work fine. Do you have any suggestions on how to implement this scenario?

CodePudding user response:

I'm not aware of any Thread Group which has milliseconds precision, but you can try to extrapolate it, for example if you need to add 100 users in 500 ms you can try kicking off 200 users in 1 second and it should be more or less desired load pattern.

The only implementation of thread pool pattern I'm aware of is Throughput Shaping Timer in combination with the Concurrency Thread Group via Feedback Function

And last but not the least there is a possibility to start new threads and stop running ones from JSR223 Test Elements like:

ctx.getThreadGroup().addNewThread(0, ctx.getEngine()) // starts new thread and returns its instance

ctx.getThreadGroup().stopThread('name of the thread', false) // stops the given thread, 2nd argument is for force stop
  • Related