📜 ⬆️ ⬇️

Using JMeter for distributed load organization



Author: Roman Denisenko, Senior DataArt Testing Engineer.

Introduction

Quite often, when testing performance, the problem arises of loading a very high-performance system capable of digesting a huge number of simultaneous requests without problems. Or it is possible that the experimental system is very sensitive to the source of the load, balancing its computing power depending on the geographical location of customers.
')
To generate such a load, the capabilities of a single test machine are no longer enough. And then the classic question arises - how can you reproduce such a load with a minimum of costs and maximum results.

Fortunately, most modern software tools used for load testing allow the use of additional remote agents needed to emulate distributed load. In this article, I would like to consider the possibility of creating a load cluster using, for example, one of the most common programs used by testers, the great and terrible Apache JMeter.

Theory

I think many people are familiar with the JMeter capabilities (if this is not the case, I highly advise reading some basic articles on the main functionality of this program to begin with), so I would like to focus more on the applicability of JMeter for distributed load.

First, let's turn to the terminology adopted by the creators of JMeter. And the terminology they have, to be honest, is rather strange. In terms of JMeter, the server that manages the load is called the “client”. Agents that receive commands from the main server and carry out the workload are called “server”. Personally, my opinion, this terminology is a little inverse, but we will leave it on the conscience of the creators. In the article I will use these terms. A typical distributed load infrastructure created with JMeter can easily be represented in the image below.



The logic of the distributed load is quite simple: the client sends the specified set of tests to each of the servers , and the servers , in turn, run these tests and send the collected results back to the client , which summarizes the information received and outputs it to the end user. Thus, the difference in how many agents we use for the load is not particularly visible, and we can work in the same way as before with one machine.

The working process:

In order to make JMeter see remote agents and be able to contact them, you must perform the following steps:
1. Download . You need to download the latest version of JMeter from the official site . The archive contains both versions - both client and server. The dependency of how JMeter starts, as a server or as a client, is determined using the keys that are passed when the main executable file of the program is started. It is worth considering the most important point - the version of the server and clients must match!

2. Installation . After that, you should unzip the downloaded archive on the machines on which we want to start the client and servers of the distributed load. One of the positive aspects - JMeter allows you to use an unlimited number of servers connected to one client. But there is an important limitation - all machines must lie within the same subnet . For cloud solutions, this is quite easily solved using VPN connections:


3. Servers . Now you should start the distributed load server. This is done quite easily. To do this, you must run the script bin/jmeter-server (.bat in the case of Windows), located in the root of the program folder.
Note : Sometimes Java incorrectly identifies the IP address of the server - in this case, you will see an exception in the jmeter-server log, which will indicate that the IP address is different from the one you want to use. Then you can assign him another IP. To do this, start the server with the following parameter: -Djava.rmi.server.hostname = [IP].

4. The client . After starting all the servers, you need to configure the client itself, which will manage the load. To force the client to find all running servers, you need to add the IP addresses of these servers to the remote_hosts property in the file bin / jmeter.properties:
remote_hosts=192.168.0.1:1099, 192.168.0.2:1098
Note : port number is an optional parameter. By default, the server uses port 1099 - however you can manually assign it.


5. Execution . The last step is pretty simple. You need to run JMeter and check that all servers are working correctly. To do this, you can try to run a distributed load using the menu item: Run -> Remote Start All . This item allows you to start the load using all the previously mentioned servers. If you need to use only a specific server, select Run -> Remote Start -> [SERVER], where [SERVER] is the address of the server that was added to the property file at step 4 and started on the client machine at step 3 .

6


Conclusion

Having done all these rather simple steps, you will be able to emulate any large load, using the power of remote servers. The desired load will be limited only by the number of free servers at your disposal and your own imagination.

useful links

jmeter.apache.org/usermanual/remote-test.htm
jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.pdf
gerardnico.com/wiki/jmeter/remote
www.guru99.com/jmeter-distributed-testing.html

Source: https://habr.com/ru/post/273967/


All Articles