BLOG
Practical step by step guide for setting up distributed JMeter
Its well known that JMeter can run in a distributed environment. This means that the complete environment has one controller (called master by JMeter) and multiple runners (which are called slaves by JMeter). I prefer to use the words controller over master and runner over slave. Even JMeter is an old tool it was difficult for me to set it up, because a simple guide for setting up was missing and the terms used by JMeter were misleading for me.
Let’s hope that this step-by-step-guide may help you to set up your distributed JMeter-environment from scratch.
Requirements
You need
- JMeter - when I wrote this article it was 5.8
- One computer which acts as a controller
- (at least) one computer which acts as a runner. It is possible to run the runner on the controller computer. If this is the only runner you are using than it might be simpler to run your JMeter tests non-distributed.
- one computer which acts as a system under test
- a JMeter test which has already been written
Overview
Jmeter uses RMI (Java Remote Interface) for communicating between controller and runners. If you wish to utilize your setup in a firewall-protected environment, it’s essential to explicitly configure the ports which JMeter should use. This step is crucial for configuring your firewall correctly. Normally the communication happens encrypted. But JMeter has a bug which does prevents you to define ports in controller and using encryption. You also need the IP-Addresses of each runner
Deployment-overview
Setting up controller and runner
Setting up the controller
- copy the JMeter package to controller and unzip it in a directory e.g.
/opt/jmeter/
which is namedJMETER_CONTROLLER_HOME
in following - Go to
$JMETER_CONTROLLER_HOME/bin
- open file
jmeter.properties
- Change the content of the following settings
client.rmi.localport
to40010
- You can choose any portnumber you want. If this property is set, JMeter uses it as base-port meaning it opens two ports above for communicating. In the given example it means the ports400011
and40012
will be opened. If you have a firewall you need to open the ports40011
and40012
. If the runners can not open a connection to that port the controller will not receive any progress information of the runners. No progress information also means that the runner can not inform the controller that execution finished.server.rmi.disable
totrue
- This is required because JMeter has a bug. If you keep encryption enabled your controller will not start and you receive a error message. Hopefully in future releases this bug gets fixed.
Setting up the runner
- copy the JMeter package to runner and unzip it in a directory e.g.
/opt/jmeterrunner/
which is namedJMETER_RUNER_HOME
in following - Go to
$JMETER_RUNER_HOME/bin
- open file
jmeter.properties
- Change the following settings
server.port
to10000
- You can choose any portnumber you want. If you have a firewall you need to open the port10001
.server.rmi.localport
to10001
- You can choose any portnumber you want. If this setting is set JMeter use it as the port where the runner waits for tasks to be executed. If you have a firewall you need to open the port10000
.server.rmi.disable
totrue
- This is required because JMeter has a bug. Since encryption was disabled in controller we also need to disable it in the runner
- If you have multiple runners repeat the steps for each runner
Running a distributed test
- You should have executed everything described under setting up
Starting the runners
- Login to a runner
- Go to
$JMETER_RUNER_HOME/bin
- Run
jmeter-server
- The runner is now running and waits for tasks to be executed
- If you have multiple runners repeat the steps for each runner
Starting the controller
- Login to controller
- Go to
$JMETER_CONTROLLER_HOME/bin
- Run
jmeter -R <RUNNER_IP_ADDRESS:PORT> -n -t <PATH_TO_JMX_FILE> -l /tmp/execution.log
- Explanation
jmeter
- this starts JMeter-R
- tells JMeter to run distributedRUNNER_IP_ADDRESS:PORT
- a configuration for given example it would be162.168.2.1:10000
-t
- do not know-l
- writes execution log to that file so you are able to analyze the result of your test- Example call with setup of this guide
jmeter -R 192.168.1.3:10000,192.168.1.4:10000 -n -t <PATH_TO_JMX_FILE> -l /tmp/execution.log
- Explanation
- You should see that the controller starts logging to the terminal
- You should see that the runner receivces some tasks which it executes
- You should see that something happens on your system under load
- Depending how large your test is,
Summary
Thanks for following this guide. I hope it works for you. If you have any questions just open an issue in one of my github repositories