An instance of jMeter can control any number of remote instances and collect the results of each one of them. This way we can perform distributed tests on a large scale.
When performing tests of this type, it is important to note that jMeter does not distribute the load. The test will run in its entirety on all the remote servers we indicate.
If the test defines 100 requests and we have 6 nodes, 600 requests will be sent to the final server. It will also not be necessary to copy the test file to each server as the software will pass it transparently to each of the servers.
First, we add the user with which we will run jMeter on each server:
su jmeter -l
On each of the servers, we need to have the Selenium plugin installed. The easiest way is to install it on our local jMeter, package the directory once installed, and upload it to the servers. But if we wanted to install it manually, we download the plugin manager:
wget https://jmeter-plugins.org/get/ -O jmeter-plugins-manager-1.3.jar
And we install the Selenium/WebDriver plugin following the instructions described in
this
link:
wget http://search.maven.org/remotecontent?filepath=kg/apc/cmdrunner/2.2/cmdrunner-2.2.jar -O cmdrunner-2.2.jar
cd JMETER_HOME
java -cp JMETER_HOME/lib/ext/jmeter-plugins-manager-1.3.jar org.jmeterplugins.repository.PluginManagerCMDInstaller
JMETER_HOME/bin/PluginsManagerCMD.sh install jpgc-webdriver
We start jMeter in server mode on each of the nodes. First, we have to make the hostname resolve to the WAN IP of each server. We check its public IP:
As root, we edit the hosts file:
IPWAN SERVERNAME
We install Chrome:
exit
We disable SSL:
# Set this if you don't want to use SSL for RMI
server.rmi.ssl.disable=true
We download the corresponding Chrome driver for the installed version:
unzip chromedriver_linux64.zip
We start the service:
We check that it starts without problems:
We add each of the servers in the client and disable SSL:
remote_hosts=kr0mtest,kr0mtest2,kr0mtest3,kr0mtest4
server.rmi.ssl.disable=true
We start jMeter and change the Path to Chrome Driver where we have decompressed it on the servers:
We check that we can run the test on any of the remote servers:
Run -> Remote Start
If the client is NATed, it will give problems. I have tried redirecting ports but without success. The best option is to create the test graphically, pass the jmx to a remote server, and execute it from there via CLI.
On the non-NATed server, we indicate the fields that must be saved in the test log:
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
jmeter.save.saveservice.response_data=true
jmeter.save.saveservice.response_data.on_error=true
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.connect_time=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.responseHeaders=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.encoding=true
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.sent_bytes=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.filename=true
jmeter.save.saveservice.hostname=true
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=true
jmeter.save.saveservice.idle_time=true
We run the test indicating the remote servers:
Then from our local jMeter, we load the Alfaexploit.jmx file and in the test listener, we load the log.xml file to be able to visualize the data graphically.
NOTE: It would be convenient to protect jMeter servers with firewall rules to prevent unauthorized users from using them.
DEBUG:
Make sure all processes are started with the jMeter user. Otherwise, the tests will fail since jMeter does not allow execution as root.
We can start the servers in debug mode:
The client can also be started in debug mode:
If we want to enable debug mode when running tests from the GUI, we must enable the desired level in the test itself:
Before attempting to run distributed tests, we can manually copy the test file to each node and run it by CLI to check that it can run without problems:
ssh SERVER
JMETER_HOME/bin/jmeter -n -t Alfaexploit.jmx -l log.xml