How to do Distributed Load Testing using Apache jMeter
Apache jMeter has some limitations while appropriate number of requests that can be simulated for load testing from a single machine. As an internet research, a single machine has sent 300-600 user requests to a server (depending on a type of test). That’s why distributed testing comes to the rescue. In a distributed setup there is one controller called Master and number of slaves controlled by the master. Distributed load testing can be tricky and may produce incorrect results if not configured correctly.
Let’s look at how to use multiple systems to perform stress testing. But before we start, there are a few things that need to be checked as mention below:
- The firewalls on the systems are turned off
- All the clients are on the same subnet
- The server is in the same subnet if 192.x.x.x or 10.x.x.x IP addresses are used. If the server doesn’t use 192 or 10 IP address, there shouldn’t be any problems
- Make sure jMeter can access the server
- Make sure you use the same version of jMeter on all the systems. Mixing versions may not work correctly
Once you’ve made sure the systems are ready, it’s time to setup remote testing. The way jMeter works is 1 master controller initiates the test on multiple slave systems.
Steps to do distributed Load testing:
- Master and all the slave PC’s should be connected to the same subnet.
- Need to have the same version of jMeter in master (system running jMeter GUI, control each slave) and slaves (system running jMeter-server, receive the command from the master and send a request to a server under test) at the same location. Run jMeter-server.bat in all slave machines (Path: jMeter\bin\jMeter-server.bat)
- Open JMeter.properties file in edit mode using any software in Master Machine (e.g. notepad++)
- Add slave machine(s) IP list in remote_hosts line using comma in Master Machine
(Path: jMeter\bin\JMeter.proeprties>> remote_hosts=192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.4, etc.)
Run Distributed load testing:
- Double click on jMeter.bat file in Master Machine (Path: jMeter\bin\jMeter.bat)
- It displayed all slave machines IP list in jMeter>> Run menu>> Remote Start
You can run individual remote slave machine or select Remote Start All for start
- Open Existing/Record New script In Master machine
- Do Thread Group setting: (No. of Slave machine: 5)
- Number of Thread (Users): 10
- Ramp-Up Period (in Seconds): 1
- Loop Count: 1
- When clicking on Remote Start All: Slave machines will send 50 requests in 1 second and this process will run 1 time (Calculation: 10 Users X 5 Slave = 50 Request)
Test results depends on the following factors:
- Network bandwidth
- Master and slave systems configuration including memory, processor speed
- Configuration of the load testing tool like number of users running in parallel
- If you are unable to run test from the above machine, you’ll see below error
- Need slave machine to run the jMeter-server.bat file once again in all machine displayed above message. In Master machine also need to restart test once again.