I am using the throughput shaping timer in combination with the concurrency thread group
In the concurrency thread group I have set ${__tstFeedback(test,1,100,10)} in order for my test to dynamically control the thread groups.
*test is the name of my throughput shaping timer.
I want to target 6rps but when running the test and checking the throughput on the summary report the throughput is 43/min.
The response time of my endpoint is anywhere from 68ms to 500ms.
Anyone have any luck in getting the shaping timer to work? Or have any other suggestions to offer?
jmeter config for concurrency thread group and shaping timer
Related
In JMeter 5.4.1, I am using 2 Concurrency Thread Groups in a test plan and each has a configuration as such:
${__tstFeedback(ThroughputShapingTimerXML,1,1000,10)}
Each thread group has 1 HTTP sampler underneath it and each HTTP sampler has a Throughout Shaping Timer
Here is my test plan:
Here is an example Throughput Shaping Timer configuration:
My intention is to be able to achieve 1 RPS on each sampler for the first X seconds, but apparently, it is splitting the 1RPS between the two samplers and trying to achieve in total 1 RPS, even though each concurrency thread group has it's own separate Throughout Shaping Timer.
There is the result I am getting:
My expectation was that the samplers would generate ~1 RPS load each and the total would be ~2.
Can someone please help me understand why this is happening?
Thanks in advance.
I cannot reproduce your issue:
Server Hits Per Second chart displays 2 RPS for the 2 Throughput Shaping Timers configured for sending 1 RPS
Server Hits Per Second graph can be installed as a part of 5 Additional Graphs bundle using JMeter Plugins Manager or there is the same chart in the HTML Reporting Dashboard
I had a very similar setup as the topic starter and here is what I have in 'Hits per second' listener (As Dmitri, I had 1 RPS max in Throughput Shaping Timer)
In some cases, I had no more than 1 hit per second. My guess here is that one API is twice slower than the other, which produced inconsistent results. I might be wrong though..
In Jmeter, I am using Concurrency Thread Group with ${__tstFeedback(ThroughputShapingTimer,1,10,10)} in combination with the Throughput Shaping Timer to dynamically change the target throughput throughout the test duration.
I want to have a JSR223 test element (Assertion or PostProcessor, does it matter?) in which to write custom logic to not log some specific error but only if it occurs near the end of the test script and I don't want to hardcode the time value.
For example if I get a java.net.SocketException in the last 2 minutes of the scheduled run time, I want to not log it, but I do want to log it in the rest of the time.
For this, I suppose that I need some way to grab the date when the test is supposed to end since the beginning of the test, evaluate it and subtract 2 minutes from it and then compare the current time with that time and then if the current time is higher, then start doing some logic to exclude the result from the logging.
Update: In the "Normal" or "Default" Thread Group I noticed that I can do this to get the initial duration:
String groupDuration = ctx.getThreadGroup().getDuration();
log.info(groupDuration)
But for the Concurrency Thread Group it does not work the same.
I would appreciate any information to help me achieve this goal.
If your Concurrency Thread Group is configured with a Throughput Shaping Timer and Schedule Feedback Function the scheduled test duration is available through a property exposed by the Throughput Shaping Timer.
props.get('elementName_totalDuration')
The element will export the following propertyy that you can access through __P function or using in JSR223 Test Elements props.get("property name")
elementName_totalDuration - Total duration as sum of the
"Duration,sec" column
elementName will be the name of your Throughput Shaping Timer
NOTE
You should set Hold Target Rate Time to a value equal or greater than the total Duration specified in the Throughput Shaping Timer schedule. Hence set this value to a very high value to avoid test completing before scheduled duration in Throughput Shaping Timer. e.g Set Target Hold rate t0 1440 minutes.
Using concurrency Thread Group with Throughput Shaping Timer and the Feedback Function
When this thread group is used with Throughput Shaping Timer, you may replace Target Concurrency value with a call to the tstFeedback function to dynamically maintain thread count required to achieve target RPS. When using this approach, leave Concurrency Thread Group Ramp Up Time and Ramp-Up Steps Count fields blank, but be sure to set Hold Target Rate Time to a value equal or greater than the total Duration specified in the Throughput Shaping Timer schedule.
For dynamic thread groups and derivatives you can use the following function:
ctx.getThreadGroup().getHold()
If you need to determine whether it is in minutes or seconds you can use
ctx.getThreadGroup().getUnitStr()
Example:
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
You can filter results after test with Filter Results Tool
If you want to remove the ramp-up phase, you could use offset filters
Using --end-offset 120 parameter (seconds)
For the given scenario in sample scenarios image with duration 1hr , i tried to set the work load model as given below with the request hits 40000 and TPM 667:
Test Plan
thread group
Loop controller
Constant throughput timer
JSR223sampler1 (sleep time 3000ms)
JSR223sampler2 (sleep time 3000ms)
JSR223sampler3 (sleep time 3000ms)
JSR223sampler4 (sleep time 3000ms)
summary report.
Since I am new to the Jmeter i am not able to set the values properly... Can anyone help me?
Thread Group needs to be set up as:
Loop Controller should be allowed to iterate infinitely:
Constant Throughput Timer should be applied to all active threads in the current Thread Group and the Target Throughput should be 667.0
The above setup should fulfil the requirements for your scenario. Also be aware that sometimes the defined number of virtual users might be not enough to reach/maintain the desired throughput, in such cases it makes sense to consider using Concurrency Thread Group and Throughput Shaping Timer combination.
I have a JMeter Test Plan where I am using different Timers like Throughput Timer, Constant Timer & Synchronizing Timer.
Throughput timer is in root of test plan, Where as other timers are only applicable within scope of controllers.
TestPlan
- ThroughPut Timer
-- ThreadGroup
---- Controller-Login
---------- Constant Synchronizing Timer
---- Controller-Action1
---------- Constant Timer (for Think Time delay)
---- Controller-Action2
---------- Constant Timer (for Think Time delay)
Throughput Timer has Target throughput at 180 and it is applied to all active threads. Which means 3 reqs/sec.
Constant Timer is used to give delay between samplers and it has varying delays.
Now, when I run Test plan with only 'Throughput Timer' enabled, then it works fine. I get expected results (approximately 3 reqs/sec) for all requests ( except first one - reasons unknown!) check graph screenshot.
However, when I enable 'Constant Timers' as well, then JMeter fails to control the throughput. Almost all of requests cross 20 reqs/sec mark. check Transactions/sec graph screenshot.
Apparently, it seems that there is conflict when I use 2 or more than 2 type of timers in JMeter. Has any one a solution or workaround for this scenario as I want to implement think-time along with controlling through put.
My Test Plan have 3 Scenarios,
Submit Quote
Check Status
If Status Complete get Quote Details.
If I keep all these 3 scenarios in one thread then CTT is not putting constant throughput, when I remove create 2 thread 1 for Submit and other for Status and Get Details I am able to maintain CTT, but my 2nd and 3rd Scenario volume drops almost 50%. As I have dependency on 1st step I am using Thread communication and not sure how I can either get CTT in one thread or get same volume from 2 different threads.
Constant Throughput Timer is useful to shape the load where there is > 1 test iteration. If your thread group has only one iteration consider using Throughput Shaping Timer instead or play with ramp-up and thread number values. It is recommended to have only one instance of the CTT in your Test Plan as it's rather resource consuming by nature.
If your scenario assumes different throughput for different thread groups you can add a CTT per Thread Group (make sure that you select All active threads in current thread group (shared) in "Calculate Throughput based on" dropdown
If ITC test elements are throttling your test below desired throughput value consider using
__setProperty()
__property()
__threadNum()
functions to implement inter-thread communication instead. JMeter Properties are global, can be accessed from different thread groups and persist all the time while JMeter is running.
See How to use JMeter's Throughput Constant Timer for details.
If above information is not enough try to elaborate your query and include i.e. thread numbers, target throughput and what kind of information needs to be shared across thread groups.