Let’s think about an end-to-end scenario for an e-commerce website. A user logs in, goes to the main page, searches for a product, sees the results and goes to the detail page of one option. Then the user will continue with performing cart and payment steps.
A real time user would be executing this scenario slowly. Because during the flow; he/she will think about his/her budget, try to find out the most charming option then fill the credit card info slowly. But a thread in JMeter; can execute this scenario much faster than a real time user, if you don’t add think time or similar elements between requests in your script.
A basic JMeter Test Plan contains a Thread Group, requests for your scenario and usually a View Results Tree element. But with these elements you can only manage the number of users, not the frequency of requests. So what a “ Constant Throughput Timer ” does, is help you to manipulate the frequency of requests.
Constant Throughput Timer
With this timer element, you can keep your total throughput value as constant. But that doesn’t mean that your test will absolutely reach that throughput value. If your system has some kind of problems or a bottleneck occurs during the test flow, your throughput value may be lower.
And what is more, throughput value doesn’t need to be constant, you can even change this value during your test flow. Let’s prepare a simple test scenario with a Constant Throughput Timer.
A Constant Throughput Timer will look like the picture above. You can add this element to your test plan by following “Thread Group -> (right click) -> Add -> Timer -> Constant Throughput Timer” path.
Target throughput (in samples per minute) value lets you manage the frequency for your requests. If you set its value as “1.0” your throughput during the test will be 1 request per minute.
Advices for Working with a Constant Throughput Timer Element
Another important thing is the number of threads. If this number is not enough to reach your expected throughput value, actual value may be lower and this can harm your testing effort.
As this timer works with a minute frequency, you should be careful about your ramp-up period. A longer ramp-up period may lead to lower throughput value.
“Calculate Throughput based on” value is also very important. If you don’t make a wise choice, your expected and actual throughput values may differ.
Even though you can manipulate the use of this element by the value above, where to place this element is also very important.
Using multiple Constant Throughput Timer elements results in confusion for your test script. So try not to use multiple of them.