How do you make a threadGroup time not be taken in consideration of the total time - jmeter

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

Related

Jmeter need to calculate ranges based on total error percentage of the Summary Report Total error

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:

Configurable number of threads in jmeter ThreadGroup

let say i want to test the same http request for 10 users, 25 users ,50 users and 100 users separately and generate a report for each group of users.
One solution is to manually create as many thread group as a number of group of users:
ThreadGroup for 10 users
ThreadGroup for 25 users
...
is there any other solution to create this plan in jmeter?
Define the desired number of threads using __P() function like:
${__P(threads,)}
When you will be running JMeter in command-line non-GUI mode you will be able to pass the number of threads using -J command-line argument like:
jmeter -Jthreads=10 -n -t test.jmx -l 10-threads-result.jtl
jmeter -Jthreads=25 -n -t test.jmx -l 25-threads-result.jtl
etc.

Jmeter start test run from command line and get result

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.

How can I test 50 threads and 60 threads ,for slave 1 and slave 2 respectively from jmeter non gui command?

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

Jmeter Distributed Environment : Active Threads Over Time : total not displayed

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

Resources