Timers are used to define the time period that you want to wait between requests. If you do not specify any, JMeter will execute the next request immediately after the current one is finished, without any waiting time.
By default, a JMeter thread sends requests without pausing between each request. It is recommend that to specify a delay by adding one of the available timers to the Thread Group. These timers will cause JMeter to delay a certain amount of time before each request that a thread makes.
If you wish to add more than one timer to a Thread Group, JMeter takes the sum of all the timers and pauses for that amount of time before executing the samplers to which the timers apply. To apply a timer to a single sampler, we need to add the timer as a child element of the sampler. This timer will be applied before the sampler is executed.
Following Timers are available in JMeter: Ref - JMeter Timers
- Constant Timer
- Gaussian Random Timer
- Uniform Random Timer
- Constant Throughput Timer
- Synchronizing Timer
- JSR223 Time
- BeanShell Time
- BSF Time
- Poisson Random Time
Let us look an example with 'Constant timer'
By using this timer, we can pause each thread for same amount of time between requests. Parameters of this timer are Name and Thread delay (These delay can be paused in milliseconds)
If you want to have each thread pause for the same amount of time between requests, use this timer.
Step 1: Right Click Test Plan>Add>Threads(Users) > Thread Group -> Leave all field as it is.
Step 2: Thread Group > Add > Config Element > HTTP Request Default -> Set Server Name as: google.com
Step 3: Thread Group>Add > Sampler > HTTP Request (Change name to Google Home Page) -.> Set Path as: /
Step 4: Thread Group>Add > Sampler > HTTP Request (Change name to Google About Page) -> Set Path as: /about
Step 5: Thread Group>Add > Sampler > HTTP Request (Change name to Google Services Page) -> Set Path as: /services
Step 6: Thread Group > Add > Listener > View Results in Table
Step 7: Save and Run the Test
Step 8: Thread Group > Add > Timer > Constant Timer.
-> Set Thread Delay (in millisecond) as 1000
Step 9: Save and Run the Test
Compare the two View Results in Table. In View Results in Table before adding Timer you can see that the
Start Time for Google About Page = Start Time for Google Home Page +
Sample Time and
Start Time for Google Services Page = Start Time for Google About Page +
Sample Time.
But In View Results in Table after adding Timer you can see that the
Start Time for Google About Page = Start Time for Google Home Page +
Sample Time +
1000 and
Start Time for Google Services Page = Start Time for Google About Page +
Sample Time +
1000. It means all users will wait 1000 milliseconds.
Add new comment