Noga Cohen is a Sr. Product Marketing Manager for CA BlazeMeter. She manages the BlazeMeter blog and other content activities. Noga focuses on creating technological content in the fields of performance, load testing and API testing, both independently and by managing writers who are developers. Noga has more than 5 years of experience in a wide scope of writing techniques: hi-tech, business, journalist and academic.

Learn JMeter in 5 Hours

Start Learning
Slack

Test Your Website Performance NOW!

Aug 11 2016

Advanced Load Testing Part 3 - Top 4 Timers

Welcome to part 3 of the “Advanced Load Testing with JMeter” series. If you missed part 2, which explained Data-Driven Testing and Assertions, check it out here.

 

In this part, we will go over the top four recommended Timers, as they are the most useful for common testing needs . Timers enable us to incorporate the natural delays users make into our tests.

 

JMeter offers many different timers. In this blog post we will go over the four types we recommend. For a more comprehensive list and explanations, see here.

 

To see the full JMeter Timer List, click on the Thread Group -> Add -> Timer

 

timers list on jmeter

 

1. The Uniform Random Timer

 

We highly recommend using the Uniform Random Timer. This is also the timer the BlazeMeter chrome extension recorder adds. Its main advantage is that it can simulate different delay lengths. This helps simulate realistic user behaviour on the web page.

 

uniform random timer on jmeter

 

The Uniform Random Timer enables you to insert two parameters:

 

1. A constant delay that will always occur

2. A random delay that occurs randomly

 

Together the two parameters create a range of optional pauses that JMeter will incorporate into the test. In this example, the threads will pause anywhere between ~9 seconds to ~14 seconds before the request it’s placed under is sent.

 

While each sampler has its own Uniform Random Timer, you can turn them all off:

 

uniform random timer, thread group, jmeter

 

After turning them off, you can move the one you want above the thread group. Its parameters will now run for each sampler. A timer will be executed before all the requests in the scope it’s in.

 

uniform random timer, thread group, jmeter

 

2. The Constant Timer

 

The Constant Timer also simulates delays between requests, but it’s used for adding a permanent delay as opposed to a randomized delay.

 

In this example, the constant delay added is 300 milliseconds long.

 

constant timer on jmeter

 

This timer will apply to every single request. If requests include additional timers, the delays will add up.

 

3. The Constant Throughput Timer

 

The Constant Throughput Timer doesn’t measure user delays but rather limits the requests per second by adding delays between the requests. This timer enables you to see what the server does and how it functions under a specific requests per second rate, which is another important way to discover bottlenecks.

 

constant throughput timer on jmeter

 

(Note that we have to adapt from requests per second to requests per minute).

 

This timer can also be modified on the fly, so if you monitor your test in real time and you notice that the server is handling X requests per second, then you can increase it to X+100 and see how it endures under the new hit rate. For detailed explanations on modifying the Constant Throughput timer on the fly, please refer to this article.

 

This timer can be applied for various threads configuration:

 

constant throughput timer threads configuration on jmeter

 

To view Throughput more accurately we need to add the Aggregate Listener.

 

aggregate listener on jmeter

 

aggregate report on jmeter

 

Now run the test. It might take some time to get to its target.

 

4. The Synchronizing Timer

 

The Synchronizing Timer stops all threads when hitting the tested Number of Virtual Users, and then has them all perform the same action at once. This Timer is useful for extra stress testing. In this example, we will test 20 users simultaneously purchasing a flight ticket.

 

synchronizing timer on jmeter

 

Add the ‘View Results in Table’ Listener. See how all the flight purchasing is occurring at approximately the same millisecond:

 

view results in table listener, jmeter

 

Congratulations! You are now ready to use Timers. Stay tuned for next time, for our final blog post in this series.

     
arrow Please enter a valid URL

Interested in writing for our Blog?Send us a pitch!

We're working on starting your first test

Testing 20 Virtual Users

Starting your test in around 2-4 minutes. Your report will appear once we've gathered the data.

0

Status: Preparing Your Test

Your email is required to complete the test. If you proceed, your test will be aborted.