Tip 2: Semi-random think time from a user
First of all, adding think-time to a Jmeter script can be done with a host different types of timers. The version I am going to propagate here works well for me, I have the feeling I have proper control over the timer this way and I can predict what it does. This does not imply that using a different way of adding think time is wrong in my view. I just happen to like this version.
My think time consists of two pieces: a Test Action with a Uniform Random Timer attached to it:
|__ Test Action > Action: Pause, Current Thread |__ Uniform Random Timer > Random Delay Max & Constant Delay Offset set
So, what do the Test Action and the Uniform Random Timer do?
The Test Action sampler is simply a sampler you can use to make a script wait for a specified amount of time.
The Uniform Random Timer however is a bit less simple to explain and understand:
The apache site states the following:
This timer pauses each thread request for a random amount of time, with each time interval having the same probability of occurring. The total delay is the sum of the random value and the offset value.
So what that means is the following.
When setting the Random Delay Maximum, the timer will pick any random value between 0 and 2000. Now add to that the Constant Delay Offset and you have the actual wait (or pause) time JMeter will use in the script in between the requests.
So in this example the value will be somewhere between 1 and 3 seconds.
Disadvantage of this method: You will need to set this think time around every HTTP Request you want to have think time.
The functions as described in this post as well as in the previous Jmeter Tip can be found in this JMX file.