Distributed Testing In JMeter

Distributed load testing in jmeter is the process of simulating large number of virtual users using multiple systems or load generators. One single machine may not be able to generate the desired virtual users for a load test due to its hardware limitations and hence jmeter allow us to connect multiple machines to achieve the goal. In JMeter, this is achieved by creating a Master-Slave configuration.

For Example, You want to run a load test with 600 virtual users but what if your machine is unable to generate more than 300 virtual users ? To overcome this issue, you can use the distributed testing in jmeter.

Master: The system running Jmeter GUI, which controls the test.
Slave: the system running jmeter-server, which takes commands from the GUI and send requests to the target system(s). In other words, it’s the load generator machine which create the threads and send request to target system to simulate the user load.

As shown in above image, is a master machine however, and are slave machines.

How to setup master-slave configuration ?

Below are the pre-requisite to setup the master-slave configuration:
1. Firewalls on all the systems should be turned off.
2. Master and all slave machines should have same jmeter version.
3. All the machines should be in the same network.

Below are detailed steps to set up the configuration:
1. On master system acting as the console, open windows explorer and go to jmeter/bin directory.
2. Open jmeter.properties in a text editor.
3. Edit the line “remote_hosts=” and add the IP addresses of slave machines. 
4. For example, in our case we will add, and the entry will look like this:


5. Restart jmeter. (Any chnage in jmeter.property file will reflect only after restarting the jmeter)
6. Create the RMI Keystore by usingbelow steps:
  • Go to master machine's JMeter bin directory
  • Open create-rmi-keystore.bat file (for windows) and create-rmi-keystore.sh (for linux)
  • Enter following details
  • A "rmi_keystore.jks" file will be created in master server's bin folder. 
  • Copy "rmi_keystore.jks" file and paste it to all slave server's bin folder.
6. Run bin/jmeter-server.bat file on all the slave machines and you are done with configuration.

Run the JMeter Test from GUI.
Now you are ready to run your first Jmeter load test with distributed configuration. In jmeter GUI go to RUN and click Remote Start ALL as shown in below image and it will start the test with all the slave machines..

Run the JMeter Test from Non-GUI (cmd): 
It is advisable to run the distributed test from Non-GUI mode. You can run it in using below command.

jmeter -n –t test.jmx -l testresults.jtl -R,
Important notes: 
1. If have set 100 users in your jmeter script and you are running the test with 2 slave machines then the jmeter will actually run the 200 users test. Each slave will create and run the 100 users.
2. You need to copy the test data file to respective slave machines.
3. You do not need create a copy of jmeter scripts in slave machines.

No comments

If you have any doubt or suggestion, please let me know

Powered by Blogger.