user1066568
user1066568

Reputation: 747

JMeter - Firing different requests in every iteration

I am currently using JMeter to simulate 5 users firing requests every 40 seconds. I have created 100 different requests but after every 40 seconds, each user is firing all 100 requests. I want to make it in such a way that after every 40 seconds, each user only fires 1 request and that request has to be different from the previous request. I would like to know what kind of controller to use (or anything else) to achieve this scenario.

Thanks

Upvotes: 9

Views: 15359

Answers (2)

Aliaksandr Belik
Aliaksandr Belik

Reputation: 12873

Try to use Random Controller.

The simplest way to implement your scenario:

Thread Group
Number of Threads = 5
Loop Count = N
    . . .
    Random Controller
        HTTP Request 001
        HTTP Request 002
        HTTP Request 003
        . . .
        . . .
        HTTP Request 100
    Test Action
    Target = Current Thread
    Action = Pause
    Duration = 40000
    . . .

This will iterate 5 threads N times.
Random Controller will RANDOMLY pick up on each step http request from "requests pool" - all the samplers added as children to Random Controller.
Test Action will pause thread for 40 secs.

Updated:
working illustration for above scheme:

Random Controller example

Thread Group
Number of Threads = 5
Ramp-Up Period = 0
Loop Count = 10

Constant Timer
Thread Delay (in ms) = 40000

You can download working example for described scheme from here: rc-plan.jmx.
This one works how you want (at least for me, Jmeter 2.5.1): it picks randomly ONE request from requests pool (in example - 10 requests) for EACH user (here - 5 users) on EACH step (here - 10 loops) and pauses each thread for 40 secs (Constant Timer).

You can also look into this mailing archive: Is their a way to randomize URL selection?.
Situation similar to your one seems to be described here.

...As per official documentation "Interactions between multiple controllers can yield complex behavior. This is particularly true of the Random Controller."

Upvotes: 15

brentj
brentj

Reputation: 121

Another option for you may be to create a CSV file with parameters for your requests ahead of time and use CSV Data Set Config to parameterize a single http request.

That obviously depends on how different your http requests are, but if it fits your requirements there are some potential bonuses with maintaining 1 http request in your test plan vs. 100.

The other details would be the same as @Alies Belik laid out -- one thread group configured for your required number of threads and loops, with a constant timer at the end for your 40 second pause.

Upvotes: 6

Related Questions