Run massively scalable performance tests on web, mobile, and APIs

Request a Demo
Sep. 23rd, 2014

How to use JMeter's Constant Throughput Timer

What is the simplest test plan in JMeter?

 

It is a single Thread Group that contains both the HTTP Sample Requests AND the View Results Tree at the end of test plan.

 

But is it a good test plan?

 

Because in this case, JMeter will send requests one by one without any pauses in between.

 

So what happens in production?

 

There is always an interval between requests and as a general rule, there are always some brief (millisecond type) delays in the network that occur and of course, in our brains- as humans, we still need some time to think and click links. That's also why we need to reproduce actual user behavior.

 

Alternative? You bet.

 

Fixed quantity of concurrent users

 

In this case, we have a fixed quantity of users but we need to test the application with a different number of requests per minute.  Using the Thread Group parameters we can manage the number of users but not the frequency of requests. So, how can we deal with this scenario?

 

JMeter has a group of elements, which are called “Timers”.  And one of them has obvious title – “Constant Throughput”. That is what we need. 

 

Constant Throughput Timer

 

This timer allows us to keep total throughput constant. Of course, if the server is not able to handle such a load, the throughput will be lower. Throughput may decrease if other timers contradict the Constant Throughput timer.

 

Although the Timer is called the Constant Throughput timer, the throughput value does not need to be constant. This value can be changed during a test.

 

Several options that can be used to change throughput value:

- Using a counter variable

- Using a JavaScript or BeanShell function to provide a changing value

- Using the remote BeanShell server to change a JMeter property

 

Attribute Description Required

 

The only paramater we need to make a decision on is where to put this timer. As my personal default, I place it into the root element of a test plan.  *Try not to use multiple Throughput Constant Timers, as this may lead to  some confusion in delays between requests in different Thread Groups.

 
throughput constant timer

 

Remember that Constant Throughput Timer is only capable of pausing JMeter threads in order to slow them down to reach the target throughput so make sure you have enough threads in order to guarantee desired amount of requests per second. Also be aware that Constant Throughput Timer is precise enough only on minute level so you need to properly calculate ramp-up period and let your test run long enough.

 

Learn more about JMeter from our free 5 day JMeter Basic Training Course

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