As JMeter has some limitations for generating requests from one single machine, we go for distributed testing to overcome it. In distributed testing we configure a Master machine and certain number of slave machines (and the no of slaves depends upon the load/users) to simulate load with more numbers of users. The master machine controls the test and slaves do the actual job.
Let's consider 4 machines which are setup on cloud with 8GB RAM configuration. One will be termed as Master and other 3 will act as slave machines.
- Ensure that the 'system firewall' is turned off
- Download latest and same version of Apache JMeter along with the supported version of Java.
- Now open the jmeter.properties file of the master machine, and add remote_hosts=192.168.10.01,18.104.22.168,22.214.171.124 (IPs of slave machines) under Remote hosts and RMI configuration.
- Though there is no need to start RMI registry separately, but if you want to run the JMeter on specific port, you can define in jmeter. properties with following command: - server.rmi.localport=4000 (define the port)
- Now open jmeter-server.bat file in all the slave machines.
- In master machine, just open JMeter (jmeter.bat) in GUI and select the test plan which you want to run and click Run in the we can see 'Remote Start' (or) 'Remote Start All' (we can see the IP of three slaves which we given in jmeter.properties file).
- By selecting Remote Start All, all the slave systems will get started. We can see in jmeter-server.bat file of slave machines.
- We will get the test results in Master-JMeter GUI itself.
Now, steps to be done before starting the distributed testing through GUI:
To run the test through command line (NON-GUI MODE):
- After setting up JMeter and turning off the system firewall.
- In slave machine go to CL (Command Line) and set the path to JMeter-bin and give the following command:
- jmeter-server.bat -Djava.rmi.server.hostname=126.96.36.199 (ip of slave machine) say enter we can see the end point to 188.8.131.52.
- Now in Master machine open CL and set the path to JMeter-bin and pass the following command:
- jmeter.bat -n -t nameofjmx.jmx -l sample.jtl -R 192.168.10.01,192.168.10.02,192.168.10.03 (Slave machine ips).
- You can find the remote engines have been started in Master.
- After the completion of test take the jtl file and browse it in JMeter GUI to get Aggregate Report or any other Graphs.
To know more about apache JMeter, read here.