What are the Timers in JMeter?

In this following article we are going to know about what is Jmeter Timers. The main purpose of the article will be, how can we use the timers, Why and where we use it.

By the name we can understand what is the timers. When we need to insert time between test steps or process(or sample) , we use this.
Timers are only processed in conjunction with a sampler. It is preprocessed to sampler.

- Timers are processed before each sampler(for single or multiple timers)
- A timer which is not in the same scope as a sampler will not be processed at all.
-If we need time after a sampler, we need to add to the next sampler

How to use
-Add the timer as a child element of any sampler
-Add the time parameter/script/conditions in the timer
-When we need to thread delay, use timers under thread.
-Some timers can be remotely invoked or scripted.

Types  : 
1. BeanShell Timer : It is for generating a standard delay. It supports  ThreadListener and TestListener methods. Important parameters are
a. Reset bsh.Interpreter before each call : When selected, the interpreter will be recreated for each sample. It can be helpful for long running scheduled  scripts
b. Parameters are passed to the BeanShell script
c. Script file contains the BeanShell script.File name is stored in the script variable FileName.
d. BeanShell script ,(returns values in milliseconds to wait)
 See this link as for more. I haven't use that.

2. BSF Timer : Making delay with using a BSF scrip.
See this link for more. I haven't used that.

3. Constant Throughput Timer : It aims to generate constant load to server. For that it changes the load parameters. It introduces variable pauses, calculated to keep the total throughput (samples/min) [As near value as possible]. We need to set the sample/min parameter along with thread to be affected. It is maintained by changing value by
a. A counter variable ,
b. A JavaScript/ BeanShell function to change value,
c.A remote BeanShell server to change a JMeter property 

-It try to keep the throughput, so there may some fluctuation .
-As it is implemented thread wise, add this under the test plan (not thread group)
-Use this for a big load generation over a limited resourced server.

4. Constant Timer : It will keep hold(pause) the step for some time. Values are provided in Milliseconds.
-Best practice to use with ajax or JS call.
-Good to simulate real life scenarios.

5. Gaussian Random Timer : When we need to pause threads for random amount of time, we use this. It has 2 parameter, a. Deviation, means this value will be difference between two random pause. b. Constant Delay Offset, means this value is constant delay after each random pause. All are in Milliseconds
-Best practice to see the behavior after any release( primary load checkup test case)
-Good for random run-time regression(health checkup) scenario. 

6.  JSR223 Timer : It generate a delay using a JSR223 script. See detail of BSF timer.

7. Poisson Random Timer : It pauses each thread for a random amount of time, with most of the time intervals occurring near a particular value.
-The total delay = Poisson distributed value +the offset value.
-Used for purposes same as gaussian random timer

8. Synchronizing Timer : It blocks thread for synchronizing the load. (it block threads until X number of threads have been blocked, and they are all released at once). "Number of Simultaneous Users to Group by" parameter means number of threads to release at once
-Used for generating large user instance at a same time
-Used for constant Max supported user hit
-Used for making a stress test environment for max support testing.

9. Uniform Random Timer : It is used for uniformly random delay(well, see, random can be uniform..:)... ). Random Delay Maximum provides max milliseconds of pause(random). Constant Delay Offset is the added milliseconds with random delay.
-Good for random run-time regression(health checkup) scenario.

10. jp@gc - Throughput Shaping Timer : (please install Google plugins to get that) By adding single or multiple row, it will show the graph of delay generation. Parameters under a row are, Start Rate Per Second, End Rate Per Second, Duration(of full delay time)



Thanks...:).. Please add comments on more uses of Timers.,

4 comments:

  1. I want to use both "Constant Throughput Timer " and "Gaussian Random Timer".
    Is that possible?

    ReplyDelete
    Replies
    1. Yes, but you have to arrange with proper hierarchy in the test plan.

      Delete
  2. I have been playing with both throughput shaping timer and constant throughput timer but I cannot get the expected results :-(

    ReplyDelete
    Replies
    1. Mail me your work, lets see what you were doing.

      Delete