Usually, we use JMeter to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types, but if we run a larger number of vusers on one client, for example, 1000 vusers, it will cost a lot of CPU, memory when the JMeter running, and the client is a bit overwhelmed, even more serious is that JMeter will be closed automatically. To resolve this situation, we must involve multiple clients to work as Load Generator to diffuse stress of running JMeter, and they will simulate a larger number of vusers and perform the stress testing against the server simultaneously.
Here is the figure shows the client-server model of Distributes testing:
Start test
Precondition:
- The firewall in all controller and agents should be turned off.
- The JMeter controller and all of the agents are on the same subnet.
- JMeter can access the server in all controller and agents
- Use the same version of JMeter on all controller and agents
Step 1) System configuration
One instance of the JMeter client can control any number of remote JMeter instances, and collect all the data from them.
For example, the computer 10.2.6.47 works as a controller and other three computers work as agents
Here are configuration for control and agents:
- Configure environment variables in the controller and agents: JMETER_HOME=c:\JMeter, path=%JMETER%\bin
- Go to the controller, set the jmeter.properties file under %JMETER_HOME%\bin and search remote_hosts= , add all agents IP after it and separate them with comma symbol, for example remote_hosts= 10.2.6.50, 10.2.6.46, 10.2.6.48.
Step 2) Run the test
- Launch jmeter-server.bat on each agent, if any parameter file the scripts need, please copy them to the agents under the path %JMETER_HOME%\bin, and make sure all content are different.
- Go to controller, after launching jmeter.bat, click Remote Start All
If 50 vusers are set in the thread group, each agent will run 50 vusers at the same time, and totally 150 vusers will perform the stress testing against the server simultaneously.
In addition, you can use a command line to start remote testing, for example, jmeter -n -t script.jmx -R 10.2.6.50, 10.2.6.46, 10.2.6.48
Step 3) Collect test result:
All results will be collected on controller’s listener element
You can go to the agent and open the file %JMETER_HOME%\bin\jmeter-server.txt see the logs in the agent.
For example: