This topic provides an overview of running Apache JMeter tests from the Controller.
JMeter tests overview
Apache JMeter is an open source load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications. If you work with Apache JMeter tests, LoadRunner Professional provides the ability to also run the tests through Controller.
By including JMeter (.jmx) scripts in your scenarios, you can run one or more JMeter tests side-by-side with any other LoadRunner Professional protocol scripts, giving you a single entry point for executing your performance tests.
The LoadRunner Professional installation includes an embedded version of JMeter. No other installation or configuration is necessary. JMeter scripts can be run on both Windows and Linux load generators. The Docker installations of Windows and Linux also support JMeter scripts.
LoadRunner Professional allows you to manipulate the number of running Vusers and the ramp-up configuration via the Controller, for your JMeter scripts. Thread properties defined in JMeter Thread Group("Number of Threads", "Ramp-up period", "Loop Count", etc.) in the .jmx file are ignored. You configure JMeter Vusers the same way as you would configure Vusers of other protocol types.
Measurements can be viewed online and offline (via Controller and Analysis), using the data points from the JMeter tests.
Transactions in JMeter scripts
JMeter tests work with threads, JMeter's equivalent of Vusers, and thread groups. LoadRunner Professional differs in the way it handles JMeter tests:
- If your JMeter script contains multiple thread groups, you will be prompted to split them into multiple scripts, where each script contains only one thread group. The ThreadGroup name is not included in the transaction name. Therefore, we recommend that you do not define transactions with the same name in different thread groups.
- Only transaction names under the TransactionController section in the .jmx file will be shown in the results.
- Transaction names should not include a dot.
Note the following guidelines before creating a scenario with a JMeter script:
- Make sure you have 32-bit or 64-bit JRE 8 or JRE 11 installed on the load generator machine.
If your JMeter script was developed with plugins, make sure to add them to the embedded JMeter installation (in the <LR_InstallDir>\bin\jmeter\lib\ext folder), to allow the script to run properly.
- For Linux load generators, it is recommended that you set the JAVA_HOME environment variable to point to the Java JRE folder.
- You can customize your JMeter configuration with some additional properties Java attributes. For details, see the Apache JMeter documentation. To customize the configuration, add the attributes to the Additional parameters box in the runtime settings, as described below.
Before running LoadRunner Professional scenarios, check that your JMeter test can run with the JMeter installation on the load generator machine.
Tip: We recommend that you use dedicated load generator machines for running JMeter test scripts. Running tests from the Controller, using the localhost load generator, may cause instability.
The JMeter script can reference parameter files in .csv format. To reference .csv files, make sure that:
- They are in the same folder (and not a subfolder) as the .jmx file.
- The reference path in the JMeter script correctly points to the .csv files.
The Controller will find these files, and send them to the load generator for execution.
Add a JMeter test to a scenario
This task describes how to create a scenario containing a JMeter script, and define its runtime settings.
To create a JMeter scenario:
- Make sure the load generator machines are set up to run JMeter tests, as described in Prerequisites for JMeter tests.
- On the main Controller toolbar, click the New Scenario button .
- In the New Scenario dialog box, click Add Scripts. From the Script Type dropdown, select JMeter Scripts.
- Click Browse and select the JMeter script (.jmx file).
- Click OK in the New Scenario dialog box. A scenario containing the JMeter script opens in the Design tab.
If you need to specify a custom JRE path, or parameters for example if you want to change the behavior of the JVM, you need to configure the runtime settings.
- Right-click the script name, and select Runtime Settings.
In the JMeter settings section, specify the details such as the custom JRE path and additional parameters.
Specify the schedule as you would for any other LoadRunner protocol. For details, see Define a schedule for the scenario.
- In the Run tab, click the Start Scenario button to begin running the scenario.
- To add Vusers during the scenario run, click Run/Stop Vusers and modify the number.
You can monitor JMeter test execution through the following standard Controller graphs:
- Running Vusers
- Transaction Response Time
- Total Transaction per second (Passed)
- Transactions per second (Passed)
- HTTP Responses per second
- Hits per Second
- Throughput - Whole Load Test
For details about the graphs, see View and customize online monitor graphs.
The following are known issues for JMeter tests running in LoadRunner Professional:
- Only Web HTTP samplers are supported for JMeter tests.
- The Setup ThreadGroup only runs once.
- The TearDown ThreadGroup is not supported.
- Loops defined in the .jmx file are ignored—they only run once.
Iteration numbers may not be correct in the Controller.
- Network Virtualization is not supported for JMeter tests.
Troubleshooting JMeter tests
The following table provides several reasons and suggested solutions for run failures:
|Cannot find the JMX file 'C:\jmeter_tests\test.jmx‘.||
|JMeter requires JRE 8+. Check the Java settings in the runtime settings or the JAVA_HOME environment variable.||Check that Java is properly installed on the machine and that the JAVA_HOME variable is set correctly.|
Failed to create pipes for JMeter.
Possible cause: Not enough available system resources.
JMeter internal error: "…"
Check the contents of the JMeter internal error as included in the message.