Thursday, June 20, 2013

JMeter-Timer



1.   Introduction to Timers
If you use just threads, controllers and samplers for load/stress testing of your application, then JMeter will just bombard your application with incessant requests. This is not the real environment or characteristic of the real traffic. Neither does it gives you control to generate a given throughput or hit with n clients at the same point of time.

So, in order to simulate real traffic or create extreme load/stress, JMeter provides you Timer elements.

2.   Configuration of Constant Timer

A constant Timer will introduce a fixed delay between consecutive requests of the same thread. Let's see an example of Constant Timer in use.

-          Test Plan->Thread Groups->Add->Timer->Constant Timer

We added Thread Delay (in milliseconds): 2000

And we run web server before and after using Constant Timer to see difference it.

+ Before System added Constant Timer

+ After System added Constant Timer


3.   Configuration of Constant Timer

Constant Throughput Timer will introduce random delays between requests in such a way that a load/stress of required throughput is sent to test application. Let's see an example of Constant Throughput Timer in use.
Adding Constant Throughput Timer as below:

Test Plan->Thread Groups->Add->Timer->Constant Throughput Timer

Configuring Constant Throughput Timer for 60 requests per minute

Result without Constant Throughput Timer

Result with Constant Throughput Timer

4.   Configuration of Synchronizing Timer

Synchronizing Timer will synchronize requests of multiple threads. What this means is, it will add delays between requests such that all threads fire at the same time thus creating heavy load bursts on your application. Let's see an example of Synchronizing Timer in use.
Adding Constant Throughput Timer as below:
-          Test Plan->Thread Groups->Add->Timer->Synchronizing  Timer
 

Adding Number of Simulated Users to Group by: 3

Result without Synchronizing Timer

Result with Synchronizing Timer



5.   Configuration of Gaussian Random Timer

I have example about configuration of Gaussian Random Timer. You see that when we used Gaussian Random Timer, It is paused the Thread for the random time.

Adding Gaussian Random Timer as below:


-          Test Plan->Thread Groups->Add->Timer->Gaussian Random Timer




-          Configuration for Thread Delay Properties such as:
Deviation(in milliseconds): 5000
Constant Delay Offset (in milliseconds): 1000




Result without Gaussian Random Timer




Result with Gaussian Random Timer


6.   Configuration of Uniform Random Timer

Work Uniform Random timer same with Gaussian Random Timer but each time interval having the same probability of occurring.




HoaLe








-