JMeter. Changing intensity with Constant Throughput Timer
JMeter is a highly extensible, open-source platform that can help identify performance issues in your application. It is among the most popular tools for performance testing. You can read more about difference between PFLB, LoadRunner and JMeter.
So in JMeter, it is no longer possible to change the intensity, the number of threads and the duration of the test by standard methods after starting the test. However, it happens that the test is already running, but you urgently need to change a parameter (for example, I often forget to indicate the test duration), for which you need to stop the test, set database to the initial state, reboot the cluster, pull the original git commit and so on. Solution: configure and run BeanShell Server. With the help of BeanShell Server one can “play” with the following settings. Let’s illustrate it on the example of intensity change.
Variables
jmeter_loc – the full path to the root jmeter folder
host, port – jmeter’s host and port for the machine, where it is running
bsh_loc – folder, containing bsh-files
new_throughput – new intensity value, op/min
old_throughput – default intensity value, op/min
JMeter configuration and start from the command line
Explanation
In the line «java –jar %jmeter_loc%\lib\bshclient.jar %host% %port% %bsh_loc%\name.bsh %new_throughput%» we call bshclient and indicate, which host and port are opened to the bsh-server, as well as which bsh-script needs a new parameter.
Example solution for a maximum search test
The project profile consisted of 20+ operation, so changing each intensity change manually is not fun. We wanted to find a maximally scalable and parametrized solution, which would allow us to use it for different projects with a different operation amount and from different loading machines.
Let’s illustrate it on the example of intensity change.
In the end we’ve written a “universal” .bat-file to change intensity,
where vals-line contains new intensity values, separated by letter “a”.
name.bsh:
In JMeter load test scenario we add a separate thread group and in it – jsr223-sampler. Constant timer is added to the thread group and the intensity change is fired by it. Base intensity values for each iteration are saved in User Defined Variables.
Function Helper explains, how to use intensity values syntax in Target Throughput.
After the .bat-file has been executed, the command line stays open, so we see that the intensity values have successfully been changed.
And that the command has looked like that:
java -jar C:/Users/User/Desktop/apache-jmeter-5.1.1\lib\bshclient.jar localhost 9000 C:/Users/User/Desktop/apache-jmeter-5.1.1/bsh\name.bsh 1344 2016 2016 240
We observe the intensity change in Transaction per Second:
The intensity has been doubled.
Conclusion
Using the described approach, you can increase and reduce intensity, thread amount and test duration, which saves time and helps to choose the optimal load options.
Related insights in blog articles
10 Steps to Great Mobile App Performance Testing Using JMeter
Nowadays, almost every company has its own mobile app which provides millions of customers with products and services for all kinds of requests. Just think of it: every day, developers upload thousands of new applications to Google Play and App Store. In this blog post, we will take a step-by-step look at how to write a load script for a mobile application and run a test by generating HTTP/HTTPS traffic on the app server using JMeter.
TestCon Europe 2025: Your Gateway to the Future of Software Testing
TestCon Europe 2024, the premier software testing conference, comes to Vilnius, Lithuania, from Oct 22-25. Join experts and enthusiasts onsite or online to explore the evolving landscape of software testing. Topics include Shift-Left Testing, TestOps, AI-Powered Testing, and more. Don't miss your chance to be part of this enriching experience. Secure your spot today at TestCon's official page and be at the forefront of software testing excellence.
Roles and Responsibilities of the Performance Testing Team
Performance testing is a specialized discipline focused on assessing system performance metrics like speed and scalability. While it shares the goal of ensuring product quality, it should not be equated with the broader scope of quality assurance. In some organizations, the performance test team operates as part of the QA team, while in others, it […]
7 Top gRPC Load Testing Tools
If you’re working with gRPC, you already know how important it is to test your system’s performance under real-world conditions. Whether you’re managing microservices or building real-time applications, the tools you use for testing can either save you time or create headaches. So, let’s not waste any time and go directly to the best gRPC […]
Be the first one to know
We’ll send you a monthly e-mail with all the useful insights that we will have found and analyzed
People love to read
Explore the most popular articles we’ve written so far
- Cloud-based Testing: Key Benefits, Features & Types Dec 5, 2024
- TOP 10 Best Load Testing Tools for 2025 Nov 7, 2024
- Benefits of Performance Testing for Businesses Sep 4, 2024
- Android vs iOS App Performance Testing: What’s the Difference? Dec 9, 2022
- How to Save Money on Performance Testing? Dec 5, 2022