JMeter: Distributed Load Testing
In the process of load testing, a tester often have to deal with a situation when resources of his computer and/or network connection are not sufficient to generate necessary load on the application being tested. There are two ways to handle this: increase the performance of the client and network which generate load or use the capabilities of distributed load testing that JMeter supports out of the box.
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:
In conclusion here are some recommendations on how to run distributed tests:
- If you want to exclude the influence of network collisions, start nodes in the same network as the tested server;
- Distributed testing requires to transmit a big amount of data, that's why it's better to simply collect the results of the testing into a file and then proceed with building graphs and performing analysis;
- Don't forget to configure JVM parameters. In particular, the size of the heap (the
jmeterfile). When there are many threads, JMeter consumes a lot of memory;
- Think through your test load scenarios carefully, if you are considering a distributed access to them, in order to ensure their independence from the 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! :)