JMeter - Firing different requests in every iteration

user1066568 picture user1066568 · Dec 1, 2011 · Viewed 13.6k times · Source

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

Answer

Aliaksandr Belik picture Aliaksandr Belik · Dec 1, 2011

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."