Running JMeter on multiple servers
In this recipe, we'll extend the Creating a web service test using JMeter recipe to run our JMeter test from multiple locations.
Getting ready
You will need to install Oracle SOA Suite 11g for this recipe.
You'll need to have completed the Installing Apache JMeter recipe for a single machine, and have the SOAP composite test configured and working correctly from the Creating a web service test using JMeter recipe.
You'll need network access to the SOA Suite server hosting your composite, and the machine hosting the first JMeter installation.
We'll refer to the installation folder for JMeter as $JMETER_HOME
for this recipe.
How to do it…
By following these steps, we can configure JMeter to use multiple machines to generate load on your application:
- Follow the steps in the Installing Apache JMeter recipe to install JMeter on the second machine. Ensure that you install the same version of JMeter on the second machine. We'll refer to the original instance of JMeter, which hosts the saved test plan from the Creating a web service test using JMeter recipe, as
JMeterServer1
, and the new installation asJMeterServer2
. - Determine the IP of
JMeterServer2
. On Windows, you can do this from the command line by using theipconfig
command, as follows: - On
JMeterServer2
, open a command-line terminal and change the directory to$JMETER_HOME
. - Run
bin/jmeter-server.bat
on Windows. On Linux, runbin/jmeter-server.sh
. - On
JMeterServer1
, within the folder$JMETER_HOME/bin
, open the filejmeter.properties
, edit the line starting withremote_hosts=127.0.0.1
and add a comma, then the IP forJMeterServer2
.remote_hosts=127.0.0.1,192.168.106.128
- On
JMeterServer1
, start JMeter with$JMETER_HOME/bin/jmeterw.cmd
on Windows, orjmeter.sh
on Linux. - Open the saved plan from the Creating a web service test using JMeter recipe. In the WebService(SOAP) request step, we need to ensure that the IP for the request points at the SOA suite server and not localhost, otherwise
JMeterServer2
will not be able to communicate with it. Alter the Server Name or IP box to add your server's IP as shown: - In the JMeter GUI, select JMeterServer2's IP from Run | Remote Start.
- Ensure that the test results are valid by examining the command-line output from the JMeter server program on
JMeterServer2
, and the GUI result listener onJMeterServer1
: - On
JMeterServer1
, run$JMETER_HOME/bin/jmeter-server.bat
on Windows;$JMETER_HOME/bin/jmeter-server.sh
on Linux. - The test can now be run across all available nodes from the GUI by selecting Run | Remote Start All.
- If the test is successful, there will be two valid SOAP test requests—one for each JMeterServer that ran the test.
How it works…
JMeter is capable of running in a "headless" mode, where Java processes act as load test agents, which are then orchestrated by a command process. In this recipe, we ran the JMeter GUI as the command process and two agents; one agent ran on the same host as the JMeter GUI and we ran another agent on a remote host.
The JMeter GUI process sends the test plan to the agents over the RMI. When the tests are complete, they are sent back to the GUI process and processed for visualization. Note that each JMeter agent runs the whole test plan; the total load is not distributed across them.
We have now initialized a multi-node load test environment that we can scale (by adding more hosts running JMeter), to place increasing loads on our SOA composites.
There's more…
There are some limitations on the network relationships between agents and the JMeter command node. The JMeter website has details on the things to consider for increasing the scale of distributed load test. See http://jmeter.apache.org.
See also
- The Checking responses in JMeter tests and Running performance tests from the Cloud recipes