Jmeter Distributed Load Test Setup for Jenkins Job

Jun 05, 2021 by ohiodn8




1. Download and unzip a copy of jmeter from their site: https://archive.apache.org/dist/jmeter/binaries/ in /opt of the server

wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.3.zip
unzip apache-jmeter-5.3.zip
mv apache-jmeter-5.3 jmeter-5.3

2. If you've done the step above for the master jmeter server, then repeat steps for the jmeter node servers.

3. On the jmeter master server, edit the jmeter.properties file and add the IPs of the jmeter slave servers to the remote_hosts line.

nano /opt/jmeter-5.3/bin/jmeter.properties

Look for the line that says remote_hosts and add your jmeter slave/node IPs to it.

E.g. remote_hosts=10.05.11.05,sample.envt.test.com

4. Generate RMI Key for secured connection to slave on the master server: (from the jmeter bin directory)

./create-rmi-keystore.sh 

When the run the create-rmi-keystore.sh script, you'll be asked some questions. Provide the answers, and when that's done, it'll generate a file called rmi_keystore.jks.

The rmi_keystore.jks should be copied to the slave servers jmeter-5.3/bin directory and also the jmeter jenkins job directory on the master server.

5. Check to see if the master server can reach out to the slave/node servers. From the master server:

nc -zvw3 10.05.11.05 1099

If its not connecting, you can check the firewall on the servers to see if they're the issue.

firewall-cmd --state

If the firewall is on, disable on master and on all slaves.

systemctl stop firewalld
systemctl disable firewalld

Check connection again:

nc -zvw3 10.05.11.05 1099

6. Start-up Jmeter server on the slave servers:

/opt/jmeter-5.3/bin/jmeter-server.sh

7. Now, you can run jmeter on jenkins, or on the jenkins master server (non-GUI). You can do that in two ways:

jmeter -n -t script.jmx -r

jmeter -n -t script.jmx -R server1,server2,...

You may also find some of the flags below useful for running JMeter from the command-line:

n to start Jmeter in a non-gui mode

t to define the test file

r to start the remote server as defined in the JMeter properties file

R to define the list of servers and start them

-Gproperty=value, define a property in all the servers (e.g -Gport=123), for further information refer to this post.

-Z, Exit remote servers at the end of the test.

Note: Make sure you've already setup the Jmeter master as the jenkins node. Then on the jenkins Job=> Shell Execute=>

/opt/jmeter-5.3/bin/jmeter.sh -n -t JMXfile.jmx -r -l JTLfile.jtl



About ohiodn8

Ruby on Rails developer, AWS Engineer, anything fun, music, a little bit of mobile game. . .

Comments