I generally use "nohup" to start Jmeter, Instead of using Cmd all the time, i have decided to configure a systemd service which runs the Jmeter all the time.
i have this below command: which basically run the jmeter and logs the output
nohup /app/jmeter/apache-jmeter-5.3/bin/jmeter -j /app/server-1/jmeter/logs/jmeter-traffic.log -n -t /app/jmeter/inputfile.jmx > /dev/null 2>&1 &
i Have created a .service file which runs the above command on
ExecStart=/app/jemter/apache-jmeter-5.3/bin/jmeter -j /app/jmeter/logs/jmeter-log -n -t /app/jmeter/inputfile.jmx > /dev/null 2>&1 &
when i started the service - i encountered various errors.
EX: class path contains multiple bindings
EX: failed to start the service
EX: failed at step EXEC spawing
EX: an error occured at arg: >
Is this the correct way of starting the service or should i be creating the shell script file to include the above command.
systemd knows nothing about your > operator so I would recommend leaving the command as it is:
ExecStart=/app/jmeter/apache-jmeter-5.3/bin/jmeter -j /app/jmeter/logs/jmeter-log -n -t /app/jmeter/inputfile.jmx
If you don't want to see JMeter output in the journal you can amend your systemd unit configuration like:
[Service]
StandardOutput=null
StandardError=journal
I would also suggest adding -l command line argument so you could store the results into a .jtl results file for further analysis
More information: How Do I Run JMeter in Non-GUI Mode?
Related
Say I'm executing a file named run.sh. I have this commands inside this file:
SERVER=${SERVER:-"localhost:5555"}
wait-for-it ${SERVER}
When I echo the ${SERVER}, I can see that it is correctly set to newserver:5555. When I run run.sh file, I get this error:
Command 'newserver:5555' not found
What am I doing wrong?
UPDATE: "wait-for-it is a script that will wait on the availability of one or more TCP services (i.e. host:port) before executing a user-defined command."
From the wait-for-it website that you linked:
Usage: wait-for-it [OPTIONS] [COMMANDS]...
Wait for service(s) to be available before executing a command.
Options:
-h, --help Show this message and exit.
-v, --version Show the version and exit.
-q, --quiet Do not output any status messages
-p, --parallel Test services in parallel rather than in serial
-t, --timeout seconds Timeout in seconds, 0 for no timeout [default: 15]
-s, --service host:port Services to test, in one of the formats: ':port',
'hostname:port', 'v4addr:port', '[v6addr]:port' or
'https://...'
So you probably want:
SERVER=${SERVER:-"localhost:5555"}
wait-for-it --service ${SERVER}
execute JMeter test in command-line and deal with the output files
jmeter -n -t test.jmx -l output.jtl
copy output.jtl output_A.jtl
after execute this file, I find that the 2nd line copy... is not executed.
Actually, jmeter will be executed for a while, and the subsequent lines may be ignored.
Now I put jmeter in another file and call it from the main command file. Can I put them into one file?
How can I deal with such situation?
Maybe you need to add && between your commands like:
jmeter -n -t test.jmx -l output.jtl && copy output.jtl output_A.jtl
More information: Using multiple commands and conditional processing symbols
I am using the following command for distributed load testing in JMeter:
jmeter -JThreadCount="5" -n -t "path.jmx" -R IP1,IP2 -l "path.csv" -e -o "outputpath"
But it does not take 5 as the thread count but runs 2 times one for each remote system. When I remove the -R parameter it takes 5 as the thread count.
How to pass the ThreadCount (variables) to the remote servers?
I do believe that you need to use -G command-line argument in order to pass the
property to the remove slaves
I don't think you need these quotation marks around 5
Suggested amended command line:
jmeter -GThreadCount=5 -n -t "path.jmx" -R IP1,IP2 -l "path.csv" -e -o "outputpath"
More information:
Full list of JMeter command-line options
Overriding Properties Via The Command Line
How to Perform Distributed Testing in JMeter
I have 5 different jmx files in my project. I need to do performance testing by running all these jmx files parallely. Currently i'm opening 5 different jmeter command prompt instance and triggering the execution.
Is there any way i can execute all these jmx files from 1 jmeter command prompt?
Depending on your operating system the options are in:
Linux: there is a parallel command, you can go for something like:
parallel --gnu << 'EOF'
jmeter -n -t test1.jmx -l result1.jtl
jmeter -n -t test1.jmx -l result2.jtl
etc.
EOF
Windows: you can create a batch script assuming start command something like:
start jmeter -n -t test1.jmx -l result1.jtl
start jmeter -n -t test2.jmx -l result2.jtl
etc.
As a cross-platform unified solution you can consider using Taurus tool as a wrapper for your JMeter script you can kick off multiple JMeter tests in parallel using simple declarative YAML syntax like:
---
execution:
- scenario:
script: test1.jmx
- scenario:
script: test2.jmx
- scenario:
script: test3.jmx
#etc
See Taurus - Working with Multiple JMeter Tests for more details.
You need to use some other tools like Ant or Maven or jenkins for that.
Please check the below link for more information:-
How to run multiple jmx scripts together in JMeter
Praveen, I don't think this is currently possible in JMeter to execute multiple .jmx files from single command , but I would suggest adding all 5 scripts in a single .jmx file if possible in your scenario.
For the first time I'm just playing around with nohup on top of an Ubuntu server. I read few docs about nohup and got to know about the running commands with options such as nohup ./server.sh &.
What I want to know is that, how should I be running the JMeter script (in headless mode) using nohup? Following is the script I needed to run with nohup:
./jmeter.sh -n -t /home/chamith/WSO2MB/new/apache-jmeter-2.13/bin/GamesSubscriber.jmx
When I tried using the normal nohup operation within the script it always throws me an error saying -n command not found. How should I move on with this? Any help would be appreciated.
Although I cannot reproduce your issue you can try surrounding your command with quotation marks like:
nohup "./jmeter.sh -n -t /home/chamith/WSO2MB/new/apache-jmeter-2.13/bin/GamesSubscriber.jmx"
Also don't forget -l key to save the results into a file.
The full command which runs script totally in the background will look like:
nohup "./jmeter.sh -n -t /home/chamith/WSO2MB/new/apache-jmeter-2.13/bin/GamesSubscriber.jmx -l result.jtl" > /dev/null 2>&1 &
References:
nohup man page
nohup Execute Commands After You Exit From a Shell Prompt
How Do I Run JMeter in Non-GUI Mode?
Full list of JMeter command-line options