Sometimes during performance testing we have to deal with high-powered systems. Such systems can painlessly handle massive amounts of requests creating an extra headache: how can you emulate such a huge load yourself, without access to the full production side hardware capabilities? Another situation occurs when the system to be tested has multiple servers where the behavior is controlled by forces on the client’s side, and therefore we have to handle a geo-distributed load.
I think every performance engineer has faced the aforementioned issues at least once in his experience. The solution is to use distributed agents to emulate the load. Almost all commercial and free software provide abilities for the utilization of external agents which work simultaneously, increasing the amount of the overall load. In this article, I would like to talk about the ways to make the most popular free performance tool emulate the load from different agents. More specifically, I will talk about JMeter and its performance load agents.
As you may already know, JMeter provides the wonderful ability to execute a distributed load by means of using external agents. In terms of JMeter, the server which manages the load is named the “client”. The agents which get commands from the main server and execute the load are named “servers”. I will use such terminology within this article.
The image below clearly shows an example of a typical infrastructure for distributed load by means of JMeter:
The client sends a copy of the tests which should be executed to each server and the servers in turn execute those tests. During the conducting of the tests, the client gathers all performance metrics stored on the servers and also provides the ability to manage each server`s state (stop/start).
In order to set up the environment for distributed load you have to perform the following steps:
Downloading. Download the latest version of JMeter from the official site. The archive contains both client and server. It differs only in the way it execute the main executable file. Also it is important that the version on servers and client must be the same.
Installing. Unzip the archive to the server and the client machines. It is possible to use an unlimited number of servers within one client. You have only one restriction, client and servers must belong to the same subnet. If you use cloud-based servers it could be easy achieved by means of a VPN.
Start servers. In order to run the server you have to execute bin/jmeter-server (a .bat in the case of Windows) script.
Note: Sometimes java doesn't determine the correct IP address of the server and you will see a connect exception in the jmeter-server log, which would indicate that an IP address is different from the one you want it to use. You can force it to use a different IP. For this you should launch the server with the following property: -Djava.rmi.server.hostname=[IP].
Start the client. After all servers have been started, you have to set up the client settings. In order to force the client to discover all servers which you have running you have to add all the servers’ IP addresses to the remote_hosts property within the bin/jmeter.properties file:
remote_hosts=192.168.0.1:1099, 192.168.0.2:1098Note: port number is an optional parameter. By default a server uses port 1099 but you can set it manually.
Execution. The last step is simple. You just have to run JMeter and verify that all servers work correctly. To do this, you should run a distributed load: Run -> Remote Start All. If you want to use only one specific server for the load, you should select Run -> Remote Start -> [SERVER] where [SERVER] is the server which you have added to the property-file during the 4th step and have run on the client machine during the 3rd step. If you wish to use all servers, just select Remote Start All.
After these simple steps, you will be able to emulate a very huge load utilizing the power of remote servers and it can be limited only by the amount of available free machines in your disposal.