JMeter sends requests without applying any delay between each sampler/request. If you perform load/stress testing on your server without any delay, it will be overloaded. Then, it won’t be able to give you realistic results and fail to simulate real world user traffic experience. JMeter Timers are the solution to all these problems. Timer element can be added in a test plan to apply wait between each sampler/request.
The JMeter Timers available are as follows:
- BeanShell Timer
- BSF Timer
- Constant Throughput Timer
- Constant Timer
- Gaussian Random Timer
- JSR223 Timer
- Poisson Random Timer
- Synchronizing Timer
- Uniform Random Timer
Let’s have a look on some common types of timer:
1: Constant Timer:
Constant Timer element delays each request in a Thread Group for the same amount of time.
- Enter Thread Delay value in milliseconds. We have entered delay of “2000” ms (which is equals to 2 seconds) in between each user request.
2: Uniform Random Timer:
Uniform Random Timer element is used to delay each request for a random period of time.
Total amount of delay = Random Delay Maximum + Constant Delay Offset
- Enter any Maximum Random Delay value in milliseconds.
- nter constant Delay Offset value in milliseconds in addition to random delay.
3: Gaussian Random Timer:
Gaussian Random Timer element is used to delay each user request for a random period of time. It has a random deviation around the Constant Delay Offset based on Gaussian curve distribution.
- Deviation Value: 100 milliseconds
- Constant Delay Offset Value: 300 milliseconds
Approximately 68% of the delays will be between (200 - 400) ms
- Constant Delay Offset - Deviation = 200 ms
- Constant Delay Offset + Deviation = 400 ms
4: BeanShell Timer:
BeanShell Timer element can be used to generate delay between each user request. For BeanShell scripting, go to this URL: http://www.beanshell.org/
5: BSF Timer:
BSF Timer element can be used to generate delay using a BSF scripting language.
6: JSR223 Timer:
JSR223 Timer element can be used to generate delay using a JSR223 scripting language.