During load testing, testers may encounter limitations with their computer and network resources, preventing them from generating the necessary load on the application being tested. To address this, there are two options: improve the performance of the client and network generating the load, or utilize the built-in distributed load testing capabilities of JMeter.
To conduct distributed testing we will need:
- 1 JMeter-client to control the testing session and collect the test results;
- N JMeter-servers (test nodes) where the load tests will be actually performed.
It should be mentioned that JMeter doesn't provide full distribution - each test node executes the testing plan in full.
Let's get to deploying and setting the environment. It is necessary to set up the same configuration (versions and plugins) of JMeter on the client and the nodes. You should also remember that the test is transmitted for execution on the node and you have to ensure the accessibility of all test data on the node: files, databases and other resources. When using PerfMon plugin, bear in mind that if you utilize variables to configure metrics, they won't work (for some reason) with remote launching.
How to start nodes and clients is described below:
# to start JMeter-server ./jmeter-server -Djava.rmi.server.hostname=192.168.0.10 # to start JMeter-client in the same local network with nodes ./jmeter # to start JMeter-client in the local network that is different from the nodes network ./jmeter -Djava.rmi.server.hostname=192.168.1.10
If your client is outside the network of the test nodes, you may need to specify the port through which the exchange of information between client and nodes will take place. For this you have to set
client.rmi.localport parameter in
jmeter.properties file and open this port for access to your client from outside.
We already know how to launch the client and nodes. There's only one small thing left - to learn how to run tests on nodes. For this we do preliminary setup of the client: you have to specify
remote_hosts parameter in
jmeter.properties file. For example:
remote_hosts=192.168.1.6,192.168.1.8. You can easily guess that these are the addresses of your test nodes. Restart the client and voila - now in the Run menu you can choose an option to start testing on remote nodes:
To summarize, here are some recommendations for running distributed tests:
- Start nodes in the same network as the tested server to exclude the influence of network collisions.
- Collect the results of the testing into a file and then proceed with building graphs and performing analysis due to the big amount of data transmission required.
- Configure JVM parameters, including the size of the heap (the HEAP parameter in the JMeter file) to avoid JMeter consuming a lot of memory with many threads.
- Carefully plan test load scenarios and ensure their independence from scenarios launched on other nodes. For example, make it possible to read test data from a certain file depending on the IP-address of the node.
Good luck with your experiments! :)