abstracta/jmeter-java-dsl

Dynamic threads spin up when desire rate is not maintained

ihsaddamhussain opened this issue · 2 comments

I wanted to check if there is any way to spin up threads dynamically. Here's my scenario, I wanted to start off my threads, say 50 threads with constant rate of 10 rps, if the response if fast enough I don't want to create additional threads but if I see the response are slow and 50 threads are unable to maintain the constant rate, I want to increment the threads to maintain the constant rps until the maxThread limit. At the end of the test I want to maintain 10 rps either with 50 threads or 500 threads doesn't matter. Is there a way to achieve this ?

here preallocated threads are 50, which I want to start off my tests with and max threads are the upper limit of the threads, I dont want to go beyond this upper limit

int rampUpSeconds = durationSeconds / 5;

JmeterDsl.threadGroup(preAllocatedThreads, Duration.ofSeconds(rampUpSeconds))
                .rampTo(maxThreads, Duration.ofSeconds(rampUpSeconds))
                .holdFor(Duration.ofSeconds(durationSeconds - 2 * rampUpSeconds))
                .children(throughputTimer)
                .children(requests.toArray(new BaseThreadGroup.ThreadGroupChild[0]));

But it doesn't to work the way I wanted. I know its a limitation with Jmeter itself, is there any close approach we can achieve this

Have you checked rpsThreadGroup? Here is a reference in user guide.

Have you checked rpsThreadGroup? Here is a reference in user guide.

Yes I figured it out, thanks for the response :)