JMeter – Timer

JMeter - Timer Element

To simulate the real-world behaviour of threads (or virtual users), there are many elements in JMeter. While browsing a typical website, a real user always clicks, waits, reads and then provides input. In performance testing term, the time spent by the user on the web page before providing any input is called ‘Think Time’. ‘Think Time’ stands for simulating real user behaviour which causes people to wait between interactions with a web application. To get more details on Think Time refer to the article Think Time in Performance Testing.

In JMeter, ‘Timer’ element simulates the real user behaviour of taking a pause on a webpage. The purpose of the ‘Timer’ element is to pause a JMeter Thread for a certain amount of time. In some cases, the Timer is used to implement the Pacing.

JMeter - Timer
Figure 01: JMeter Timer Elements

Scope of JMeter Timer:

1. Global Timer Scope: When a timer is added to a test plan then pause (think) time is applied to all the thread groups (including individual sampler) under that test plan.

JMeter - Timer at Global Level
Figure 02: Global Timer

Execution Flow:

JMeter - Timer at Global
Figure 03

2. Thread Group Level Timer Scope: When a timer is added to a thread group level then pause (think) time is applied to all the samplers under the same thread group. 

JMeter - Timer at Thread Level
Figure 04: Thread Group Level Timer

Execution Flow:

JMeter - Timer at Thread Level
Figure 05

3. Parental Level Timer Scope: When a timer is added to a parent controller then pause (think) time is applied to all the samplers under parent controller as well as child controller (including individual sampler under child controller). 

JMeter - Timer at Parent Level
Figure 06: Timer at Parent Controller Level

Execution Flow:

JMeter - Timer at Parent Level
Figure 07

4. Child Level Timer Scope: When a timer is added to a child controller then pause (think) time is applied to only those samplers which are under the same child controller. 

JMeter - Timer at Child level
Figure 08: Timer at Child Controller Level

Execution Flow:

Figure 09

5. Sampler Level Timer Scope: When a timer is added to a sampler then pause (think) time is applied to only that particular sampler.

JMeter - Timer at Sampler level
Figure 10: Timer at Sampler Level

Execution Flow:

Figure 11

6. Multi-Level Timer Scope: When multiple timers are added to a test plan at a different level then pause (think) time for that sampler will be equal to the sum of all timers.

JMeter - Timer at Multilevel
Figure 12: Timer at Multilevel

Execution Flow:

Figure 13

Some important points related to Timer:

  1. The Timer is executed before the sampler’s execution but after the PreProcessor.
  2. The parent timer is applicable to all siblings and child elements under one parent element.
  3. If there are multiple timers added at the above level then the think time for a sampler will be equal to the sum of all timers.
  4. The response time of the sampler does not include the execution time of the Timer.

The available JMeter Timer elements are:

  1. Bean Shell Timer
  2. Constant Throughput Timer
  3. Constant Timer
  4. Gaussian Random Timer
  5. JSR223 Timer
  6. Poisson Random Timer
  7. Synchronizing Timer
  8. Uniform Random Timer
  9. Precise Throughput Timer

Possible Parent element(s):

  1. Test Plan
  2. Thread Group
  3. Test Fragment
  4. Sampler
  5. Logic Controller
  6. Non-Test Element

Possible Child Element(s):

  • NA

Leave a Reply

Your email address will not be published. Required fields are marked *