How to run jmeter test through remote servers via jenkins - jmeter

I am having a linux machine (say m1) [an openStack machine] to run my jmeter test.
My typical process was to put latest jmx file on this machine and trigger below command:
nohup /path/to/jmeter/bin/jmeter -n -t /path/to/script/test.jmx -l /path/to/resultsFolder/results.jtl
Now, I want to trigger same test via jenkins job which should actually do the same activity as above.
I perform two activities (one is to manually trigger jmeter-server on m1 and other to run jenkins job to run test via m1)
To start jmeter server
Ran following command manually on m1 ( SERVER_PORT=1099 nohup /path/to/jmeter/bin/jmeter-server)
Jenkins Job
I have created a jenkins pipeline job:
Stage1: checks out jmeter in jenkins master
stage2: checks out latest script in jenkins master
stage3: Runs jmeter remote test -
command used :
sh '''
chmod u+x jmeter/bin/jmeter.sh
jmeter/bin/jmeter.sh -n -t path/where/jenkins/checked/latest/test/test.jmx -R 10.X.X.X -l results.jtl'''
Stage1 and stage2 runs perfectly.
Stage3: console output shows as below
jmeter/bin/jmeter.sh -n -t jmeter/bin/jmeter.sh -n -t path/where/jenkins/checked/latest/test/test.jmx -R 10.X.X.X -l results.jtl
Creating summariser
Created the tree successfully using path/where/jenkins/checked/latest/test/test.jmx
Configuring remote engine: 10.X.X.X
Starting remote engines
Starting the test # Tue Aug 14 10:41:46 CEST 2018 (1534236106818)
Remote engines have been started
Waiting for possible shutdown message on port 4445
And it keep showing processing ......... unless I trigger manual shutdown.
So, I'm looking for two things
a mechanism to start jmeter-server on slave nodes via jenkins job itself
Running test via remote machines (which can go locations within load machine and trigger test from there itslef)
. Any ideas appreciated. Thank you in advance!

You can launch jmeter server on remote slaves in at least 2 ways:
From Jenkins using Jenkins SSH Plugin
From JMeter itself using OS Process Sampler or SSH Command plugin (in this case you will have 2 scripts, one which will set everything up and another will be the main test in distributed mode.

Related

JMeter - Remote Testing on Linux

I am executing JMeter remote testing with 1 master machine (192.168.0.1) and with 7 slave machines with 3 VMs (192.168.0.2 to 192.168.0.4) on a network interface and 4 other VMs (192.168.0.5 to 192.168.0.8) are in a different network interface.
My JMeter script is located at Master machine - 192.168.0.1
I tried to execute my test with the following command
./jmeter -n -t /home/lup01/Document/LuP2021/ITonICE_Lasttest_InfluxDebug_09032021.jmx -l /home/lup01/Document/LuP2021/LuP2021_LastTest_001_14-10-2021_7VMs.jtl -R 192.168.100.2,192.168.100.3,192.168.100.4 -Djava.rmi.server.hostname=192.168.100.6,192.168.100.7,192.168.100.8,192.168.100.9
However, the test never started. the screen just hung and after 15 minutes i had to stop the test. I did the sample run only with 3 threads.
On course of debugging, i also checked that, when i executed the test with
./jmeter -n -t /home/lup01/Document/LuP2021/ITonICE_Lasttest_InfluxDebug_09032021.jmx -l /home/lup01/Document/LuP2021/LuP2021_LastTest_001_14-10-2021_7VMs.jtl -R 192.168.100.2,192.168.100.3,192.168.100.4
the test was running fine with 3 VMs which are on the same interface as the master machine
However, when i executed the 2nd part
./jmeter -n -t /home/lup01/Dokumente/LuP2021/ITonICE_Lasttest_InfluxDebug_09032021.jmx -l /home/lup01/Dokumente/LuP2021/LuP2021_LastTest_001_14-10-2021_7VMs.jtl -Djava.rmi.server.hostname=192.168.100.6,192.168.100.7,192.168.100.8,192.168.100.9
the test got executed but the load was generated only on the master machine (192.168.0.1). i validated this by printing the host name in the result file.
Can someone please guide me what changes i need to do to get the test running successfully and the load being generated at the slave machines 192.168.100.6 to 192.168.100.9?
JMeter Master machine doesn't generate any load, it only reads .jmx script, transfers it to slaves and collects results.
It doesn't make sense to run more than 1 JMeter process on 1 machine, it doesn't provide any benefit and just consumes resources, if you have only one machine - run a single JMeter process, just make sure to follow JMeter Best Practices and properly tune this JMeter instance for high throughput testing
If this is some form of an experiment and you have to run multiple JMeter processes on a single host and would like to bind different JMeter instances to different network interfaces - you can do it via "Advanced" tab of the HTTP Request sampler (or HTTP Request Defaults if you have more than one sampler) like it's described in Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter

Jmeter Distributed Setup works in GUI but not the command line

I am running Windows 7 Pro with JMeter 4.0 r1823414 on all 5 machines with Java JDK 1.8.0_144 on all of them as well. All paths and ENV Vars are identical across all machines. I set my remote hosts in the master and I am able to see them on the GUI inside the master. I built the rmi_keystore.jks on a slave machine and copied it into the bin folder in every machine. I successfully started all the servers on the slave machines and see the successful attachment of the rmi (running the jmeter-server.bat):
Found ApacheJMeter_core.jar
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xbootclasspath/a:"C:\Program Files
(x86)\HP\Unified Functional Testing\bin\java_shared\classes\jasmine.jar"
Created remote object: UnicastServerRef2 [liveRef: [endpoint:
[<ip:port>,SSLRMIServerSocketFactory(host=<host_name/IP>,
keyStoreLocation=rmi_keystore.jks, type=JKS,
trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi),
SSLRMIClientSocketFactory(keyStoreLocation=rmi_keystore.jks, type=JKS,
trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi)](local),objID:
[<stuff>:-7fff, <more_stuff>]]]
Running a basic HTTP call I am able to run from the master to all 4 slave machines (individually and all at once) and get results without issue from the GUI. My problem is from the command line. I cannot get the test to run. I have tried:
jmeter -n -t distributed_test_4_slaves.jmx -r -l distributedLog_Test.jtl -Jserver.rmi.ssl.keystore.file=rmi_keystore.jks
jmeter -n -t distributed_test_4_slaves.jmx -r -l distributedLog_Test.jtl
jmeter -n -t distributed_test_4_slaves.jmx -R <all_my machine_names> -l distributedLog_Test.jtl (with and without -Jserver.rmi.ssl.keystore.file=rmi_keystore.jks)
jmeter -n -t distributed_test_4_slaves.jmx -R <all_my machine_names:ports> -l distributedLog_Test.jtl (with and without -Jserver.rmi.ssl.keystore.file=rmi_keystore.jks)
jmeter -n -t distributed_test_4_slaves.jmx -R <all_my machine_ips(with and without ports)> -l distributedLog_Test.jtl (with and without -Jserver.rmi.ssl.keystore.file=rmi_keystore.jks)
Every time I get the same errors in the command line:
Creating summariser <summary>
Created the tree successfully using distributed_test_4_slaves.jmx
#The next 5 lines repeat for each slave
Configuring remote engine: <slave_1..4>
Exception creating connection to: <slave_1..4>; nested exception is:
java.io.FileNotFoundException: rmi_keystore.jks (The system cannot
find the file specified)
Failed to configure <slave_1..4>
Stopping remote engines
Remote engines have been stopped
Error in NonGUIDriver java.lang.RuntimeException: Following remote
engines could not be configured:[
<slave_1>, <slave_2>, <slave_3>, <slave_4>]
What am I missing? Why would it run and work in the GUI but not on the command line? Something cannot be right.
Make sure that
You either run JMeter from its "bin" folder
Or have rmi_keystore.jks in the folder where you're running JMeter from
as the error clearly states that JMeter tries to load rmi_keystore.jks file and fails
One more thing to try is providing full path to the rmi_keystore.jks file via server.rmi.ssl.keystore.file property.
You can also completely disable secure RMI communication by setting server.rmi.ssl.disable property to true
Normally jmeter.log file should contain the root cause of the issue, if it doesn't or not very informative - you can increase JMeter log verbosity for selected clas(ses) or package(s).

Unable to connect to remote machine in jmeter

I am trying to launch my jmeter tests in a remote machine as i will be running bulk users on a .jmx file (Approx 200 000 threads). I have a remote machine where i have downloaded jmeter and saved the folder in desktop. and in command prompt i have a command
Desktop\apache-jmeter-4.0\bin>jmeter-server -n
Could not find ApacheJmeter_core.jar ...
... Trying JMETER_HOME=..
Found ApacheJMeter_core.jar
Created remote object: <Have a message saying the server is up and running>
Now in jenkins i have a command
export JAVA_HOME=/java/1.8.0.65
bin//jmeter -n -R <Remote HOst IP> -t file.jmx -l result.jtl -e -o/resultfolder
When i trigger the job in jenkins i am getting
Configuring remote engine: <Remote machine IP>
Exception creating connection to: <Remote machine IP>; nested exception is:
java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)
Failed to configure <Remote machine IP>
Stopping remote engines
Remote engines have been stopped
Error in NonGUIDriver java.lang.RuntimeException: Following remote engines could not be configured:<Remote machine IP>
I have a rmi keystore file created in remote machine.
You need to launch create-rmi-keystore.sh script on all machines and make sure that the configuration is the same, this way communication between JMeter master and slaves will be secure.
More information: Remote Testing: Setting Up SSL
If you don't want the communication between the master and slaves to be secure - you can amend the command line to:
jmeter -Jserver.rmi.ssl.disable=true -n -R <Remote HOst IP> -t file.jmx -l result.jtl -e -o/resultfolder
or add the next line to user.properties file on all hosts to make the change permanent:
server.rmi.ssl.disable=true
JMeter restart will be required to pick the property up. See Configuring JMeter user manual chapter for more information.
Depending on your test nature 1 slave might be not enough to simulate 200k threads so make sure you're following recommendations from the 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article and keeping an eye on JMeter engines health using built-in OS tools or JMeter PerfMon Plugin as if JMeter will not be able to send requests fast enough - you will get lower throughput/higher response times even if your application is not overloaded.

Should jmeter master start after 1/2 minutes of server started when running tests in non gui mode (master and slave)

Bamboo-jmeter task: Should time gap there before starting the jmeter master/slave. We have created bamboo task (SSH task1-with slave host, SSHtask2-with 2nd slave host, SSH task3-with master host and run commands). When first time the the task getting an error remote engine is not able to configured whereas able to telnet the hosts, also jmeter-server is already started.
However when disable SSHtask1 and task2 for the 2nd time run, it is able to run successfully and getting results also.
Should jmeter master start after 1/2 minutes of server started? Please suggest
Able to overcome the problem by adding sleep time of 120 seconds after running the jmeter-server before starting the jmeter master.

NotConnectedException error in WebDriver tests running under Jenkins on Linux

I have a WebDriver test using the FirefoxDriver that I am attempting to run as a Jenkins job.
It works fine in Windows, it also works from the command line in Linux, where my Jenkins server lives.
Unfortunately, I got the following error during executing as a Jenkins job:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
The Jenkins job consists of 2 steps: a shell step that executes:
Xvfb :1 -screen 0 1024x768x24 &
export DISPLAY=:1
And then a maven package to run the test class.
Why can't I get the Jenkins job to execute Firefox?
What finally ended up working was to create the entire Jenkins job as one step that ran shell commands:
Xvfb :1 -screen 0 1024x768x24 &
export DISPLAY=:1
mvn package
and that worked. No more NotConnectedException.
I had originally had the Jenkins job as 2 steps, shell to create virtual frame buffer and maven goal.
When you run the job from jenkins, it runs the same test as "Jenkins" user. You need to add one more line in etc/hosts file for jenkins user like
your.ip.address.value jenkins

Resources