JMeter timers are Apache JMeter components that are used in the popular open-source performance testing tool. Timers are in charge of introducing delays or pauses between requests in a test plan in order to simulate actual user behavior. They assist in the creation of a more precise load on the system under test.
We can add timers to the JMeter test plan by right-clicking on a sampler or a controller and selecting "Add" -> "Timer." Timers can be placed at the thread group level to apply to all requests or at specific samplers or controllers to control delays for specific parts of the test.
JMeter provides various types of timers, each serving a specific purpose. Here are some commonly used timers:
This timer introduces a fixed delay between each request. It is useful when we want to maintain a constant throughput. To add a Constant Timer in JMeter, follow these steps:
Open the JMeter test plan or create a new one.
Right-click on the thread group or the specific sampler/controller where you want to add the Constant Timer.
From the context menu, go to "Add" -> "Timer" -> "Constant Timer." A Constant Timer configuration dialog box will appear. Here, you can set the following parameters for the Constant Timer:
Thread Delay (in milliseconds): Specify the delay value in milliseconds that you want to introduce between each request. For example, if you want a delay of 1000 milliseconds (1 second), enter "1000" in the field.
Calculate between iterations: If this is enabled, the delay will be calculated between consecutive iterations of the same thread. If it's disabled, the delay will be applied after each request, regardless of the iteration. Choose whether you want to calculate the delay between iterations or after each request based on your requirements.
Click "OK" to add the Constant Timer to your test plan.
The Constant Timer will now be added to the selected location in your test plan, and it will introduce the specified delay between each request or iteration.
It adds a delay that follows a Gaussian distribution, allowing for more realistic variations in user think time.
The steps to add a Gaussian Random Timer in JMeter are similar to the steps provided above. The parameters for Gaussian Random Timer are:
Constant Delay Offset (in milliseconds): Specify the constant offset value in milliseconds to add to the calculated delay. This value is optional.
Deviation (in milliseconds): Set the deviation value for the random delay, which represents the standard deviation of the Gaussian distribution.
Random Delay Maximum (in milliseconds): Specify the maximum value for the random delay. The actual delay will be a random value between 0 and this maximum value.
This timer adds a random delay within a specified range. It helps simulate different think times between requests.
In the Uniform Random Timer configuration, set the "Random Delay Maximum" field to define the maximum delay in milliseconds.
This timer allows us to synchronize a group of threads, making them pause until a specified number of threads have reached a specific point in the test plan. It is useful for simulating concurrent user behavior. You can set the following parameters based on your requirements:
Number of Simulated Users to Group by: Specify the number of threads (users) you want to synchronize. This indicates how many threads need to reach the timer before they are released simultaneously.
Time-out in milliseconds: Set the maximum time to wait for all threads to reach the timer. If the time-out is reached before all threads arrive, they will be released anyway.
This timer adjusts the delay between requests dynamically to achieve a specific target throughput. It helps maintain a desired number of requests per second. You can set the following parameters based on your requirements:
Target Throughput (in samples per minute): Specify the desired number of requests or samples per minute that you want to maintain.
Calculate Throughput based on: Choose the scope for calculating throughput. You can select "this timer only" to calculate the throughput for the specific timer or "all active timers" to include other timers in the calculation.
The examples above demonstrate the structure of how timers can be added to a JMeter test plan. We can configure the specific properties of each timer according to our testing requirements and desired delay patterns.
These timers can be added to individual requests or placed at the thread group level to apply to all requests within that group. They offer flexibility in controlling the pacing of requests and simulating real-world scenarios during performance testing with JMeter.
Free Resources