I have a JMeter distributed environment (localhost and host1)
localhost (master and slave)
host1 (slave).
I have a thread group in my test plan with 10 users and 50 loops.
Running the test as bellow :
jmeter.bat -t myscript.jmx -n -r -l results.csv
My test runs successfully and I get a total of 20 threads as displayed on the output
summary + 800 in 30,2s = 26,5/s Avg: 580 Min: 33 Max: 2315 Err: 0 (0,00%) Active: 20 Started: 20 Finished: 0
But when I try to graph "jp#gc - Active Threads Over Time" with data in results.CSV , I just get the number of active threads = 10 .
My question is how can I get a Grape with all 20 threads running?
The main problem is that I suspect that result.csv is not complete and does not contain all performance information such as response time etc.
For JMeter version < 5.0 :
This is because you need to add a unique ID per injector in Thread Group name as per documentation:
https://jmeter-plugins.org/wiki/ActiveThreadsOverTime/
For example:
If running only 1 JMeter per machine:
${__machineName()}_My Threadgroup name
If running multiple injectors per machine::
${__P(JVM_ID,1)}_My Threadgroup name
For version >= JMETER 5.0:
It will work correctly Out Of The Box as per this fix:
https://bz.apache.org/bugzilla/show_bug.cgi?id=62684
Related
image of summary report
I need to create script to use this total error % then calculate something like
If error% is between 10 and 20 % console log message
If error% is between 21 and 40% console log message
If error% is between 40 and 60% console log message
If error% is majors than 61% console log message
Any suggestions ??
a lot of different none working approaches
I tried using the performance plugin in Jenkins but didn't worked well for this case
A "script" in which language? And are you sure you really need this because Summariser already includes this functionality
If you run JMeter test in command-line non-GUI mode like:
jmeter -n -t test.jmx -l result.jtl
The result.jtl is a CSV file which contains test metrics like sampler label, elapsed time, whether it was successful or not, etc.
So you could process the .jtl file somewhere in tearDown Thread Group and calculate the failed requests percentage with JSR223 Sampler
Code as text just in case:
SampleResult.setIgnore()
def jtl = new File('result.jtl').readLines()
def results = jtl.takeRight(jtl.size() - 1).collect { result -> result.split(',')[7] }
def failures = results.count { it == 'false' }
def failuresPercentage = (failures * 100.0f) / results.size()
println('Percentage of failures: ' + failuresPercentage + '%')
and in action:
I try to run command ./jmeter.sh -n -t ../../apache-jmeter-4.0/test-case-2018/jmeter_cron.jmx and i got log message :
Starting the test # Mon Jul 09 17:44:48 ICT 2018 (1531133088159)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary = 0 in 00:00:00 = ******/s Avg: 0 Min: 9223372036854775807 Max: -9223372036854775808 Err: 0 (0.00%)
Tidying up ... # Mon Jul 09 17:44:48 ICT 2018 (1531133088762)
... end of run
It's seem nothing run .
PS: But i run in my desktop ( Windows 10) it's show result as normal . it's the log message from my desktop :
Starting the test # Mon Jul 09 17:09:03 ICT 2018 (1531130943233)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port
4445 summary + 1 in 00:00:01 = 1.4/s Avg: 346 Min: 346
Max: 346 Err: 1 (100.00%) Active: 1 Started: 1 Finished: 0
summary + 6 in 00:00:01 = 5.1/s Avg: 179 Min: 176 Max:
184 Err: 0 (0.00%) Active: 0 Started: 2 Finished: 2 summary =
7 in 00:00:02 = 3.7/s Avg: 203 Min: 176 Max: 346 Err: 1
(14.29%) Tidying up ... # Mon Jul 09 17:09:05 ICT 2018
(1531130945291) ... end of run
Could anyone can help me ?
CSV Data Set Config filename can be tricky in different environments,
Notice you can use absolute path (not in distributed test) but it may be specific for each OS.
You can use Relative path according to path of the active test plan
Notice that Linux can be case sensitive so make sure driven_data.csv all in lower case
Filename Name of the file to be read. Relative file names are resolved with respect to the path of the active test plan. For distributed testing, the CSV file must be stored on the server host system in the correct relative directory to where the JMeter server is started. Absolute file names are also supported, but note that they are unlikely to work in remote mode, unless the remote server has the same directory structure. If the same physical file is referenced in two different ways - e.g. csvdata.txt and ./csvdata.txt - then these are treated as different files. If the OS does not distinguish between upper and lower case, csvData.TXT would also be opened separately.
Double check that:
The file /data/driven_data.csv exists, you will have to copy it from the master node as JMeter doesn't do this automatically
The user account has read access to the /data/driven_data.csv path, if not - grant it using the following command:
sudo chmod -R a+rX /data/driven_data.csv
See online chmod manual page or type man chmod in your terminal to get full help on the command.
Just FYI: the easiest way to implement the data-driven distributed testing in JMeter is using HTTP Simple Table Server which allows sharing the same data file between multiple slave instances so you will not have to copy the file to the remote slaves.
You can install HTTP Simple Table Server using JMeter Plugins Manager
I want to execute jmeter from command line and get the result on screeen. I am using following command for this,
jmeter -n -t "D:\\apache-jmeter-4.0\\bin\\Test.jmx" -l result.jtl
This command displays the result on screen on summary format like below,
summary + 1 in 2s = 0.5/s Avg: 1917 Min: 1917 Max: 1917 Err: 0 (0.00%) Active: 10 Started: 10 Finished: 0
summary + 99 in 6s = 17.9/s Avg: 482 Min: 203 Max: 2009 Err: 0 (0.00%) Active: 0 Started: 10 Finished: 10
summary = 100 in 6s = 18.1/s Avg: 497 Min: 203 Max: 2009 Err: 0 (0.00%)
And data in result.jtl is
2018/06/05 20:34:58.307,1917,Home Page,200,OK,Thread Group 1-9,text,true,138969,629
2018/06/05 20:34:58.278,2001,Home Page,200,OK,Thread Group 1-5,text,true,138969,658
......
I read in document that Jmeter calculates the summary from this data to display on screen and raw data is directed and stored to result.jtl file. But I want to get the same raw data on console which I may pick for further custom checks and calculation. Is it possible to get the result.jtl data on screen ? if yes, please suggest me how it can be achieved.
Thanks
If you want just to print .jtl file contents into terminal you can use type or more commands like:
type result.jtl
You might also be interested in JMeterPluginsCMD Command Line Tool which allows generation of different tables and charts basing on .jtl results file from command line.
Also be aware that according to JMeter Best Pratices you should always use the latest JMeter version (JMeter 4.0 as of now) as newer versions normally contain bug fixes, performance improvements and new features and JMeter 2.11 is 4+ years old. For example since JMeter 3.0 it is possible to generate HTML Reporting Dashboard.
I have the following scenario:
Thread group1 - this sends requests to a server (lots of threads and iterations)
HTTP Request
Thread group2 - 1 thread 1 iterations
JSR223 sampler (has a while loop which periodically check if a number is 0) and collects some times
The scenario ends when threadgroup 2 finishes
I run the above scenario using the non GUI mode and i am interested in the RPS. (as shown below 222.0/s), but only for the first threadGroup.
summary = 50002 in 00:03:29 = 222.0/s Avg: 4151 Min: 38 Max: 797601 Err: 0 (0.00%)
Now, when the last threadGroup ends i will have:
summary = 50003 in 00:09:12 = 90.7/s Avg: 4136 Min: 38 Max: 797601 Err: 0 (0.00%)
The RPS is now low only because the last threadGroup takes very long to finish.
Is there any way the time from the last threadGroup can not be taken into consideration of the total time ? Or maybe another approach to this problem.
You can use jmeter.reportgenerator.sample_filter property in order to exclude your JSR223 Sampler from the report.
Run your test in command-line non-GUI mode like:
jmeter -n -t test.jmx -l result.jtl
The command to generate FULL results would look like:
jmeter -g result.jtl -o ALL-RESULTS
It will create ALL-RESULTS folder holding information on all the samplers
The command to generate results WITHOUT JSR223 Sampler would be:
jmeter -Jjmeter.reportgenerator.sample_filter="^((?!JSR223 Sampler).)*$" -g result.jtl -o FILTERED-RESULTS
It will create FILTERED-RESULTS folder with HTTP Request sampler only (or whatever else samplers, only JSR223 Sampler(s) will be excluded.
More information:
Generating Report Dashboard
Configuring JMeter
Apache JMeter Properties Customization Guide
Scenario :
I have 2 slave machines configured , I want to send 50 users for slave 1, 60 users for slave 2 . I am using non GUI jmeter from command .
IP Address example :
Slave 1 : 1.0.0.1
Slave 2 : 2.0.0.2
Jmeter test plan configuration variables:
Number of threads :${__P(threads1,)}
Ramp-up period : ${__P(threads2,)}
Loop Count : ${__P(threads3,)}
I tried following command on jmeter start, but its not working as per expected:
jmeter -n -t POC1.jmx -R 1.0.0.1,2.0.0.2 -Gthreads1=50 -Gthreads2=1 -Gthreads3=1, -Gthreads1=60 -Gthreads2=1 -Gthreads3=1
Please help me if I am wrong in above command , please tell me how can I send 50 user threads , ramp up period 1 and loop count 1 for slave 1 and 60 user threads ramp up period 1 and loop count 1 for slave 2.
You won't be able to do it the above way as:
All remote slaves are executing the same test plan
You can pass global properties via -G command-line argument, so all the remote clients will be having the same properties set
The solution is to use different user.properties on different slaves, like:
Define amount of virtual users in your Test Plan using __P() function like:
${__P(threads,)}
On first slave add the next line to user.properties file (lives in JMeter's "bin" folder)
threads=50
On second slave add the next line to user.properties file
threads=60
Restart JMeter on slaves
You can also pass threads property value via -J command line argument while starting JMeter servers like:
On first slave
jmeter -Jthreads=50 -s -j jmeter-slave1.log .....
On second slave
jmeter -Jthreads=60 -s -j jmeter-slave2.log .....
See Apache JMeter Properties Customization Guide for more information on using JMeter properties, setting and overriding them