Constant Throughput Timer JMeter - jmeter

I am trying to achieve goal of 3 TPS using all my threads. I used Constant Throughput Timer but somehow it doesn't provide constant TPS. It does go beyond 3 TPS like sometime 10TPS.
Test Scenario
Thread Group 1
This Thread group submit XML on server and check the status.
I put constant Timer under this Submit Quote action and set value as 3 per min.
After each Quote Submit i will perform some action.
Thread Group 2
This Thread group submit XML on Server and check the status as like first Thread group but the rest action are different than first.
I put constant Timer under this Submit Quote action and set value as 3 per min.
Thread Group 2
This Thread group submit XML on Server and check the status as like first & Second Thread group but the rest action are different than first & Second.
I put constant Timer under this Submit Quote action and set value as 3 per min.
I need 3 TPS from all these Thread Groups for Submit Quote step, i am able to achieve that somewhat but it's not constant.
Can some please help to manage TPS?
Below is the Graph you can see some high transactions:

CTT will give you "constant" throughput after some time, not in such reduced time as your test shows.
The peak you see come from variation of your server response time.
Maybe you can try this method:
Configure thread group :
Loop count = 1
Ramp up period = time of your test (3600 seconds for my example)
Delay Thread creation until needed = true
Scheduler duration = 3600 seconds
Scheduler startup delay = 0
if you run for 1 hour, to achieve 3 Trans per minute, set number of threads to 180.

I am able to manager this up to some extend by separating actions in to multiple threads. In my earlier example in Thread 1 i was performing some action which impacted CTT. To resolve issue, i am using Queue concept.
First separate your thread's, if any action in your takes time move them to separate thread. In below example actions QuoteStatus and further were part of my thread 1 and due to slow response from server it was not allowing me CTT.
If you look at above response time from Thread one its pretty constant, having multiple actions is one thread cause issues. If your goal is to put constant throughput, it would be good to keep one action each thread and then use Inter_Thread Communication to pass data in other threads.

Related

How to provide jmeter thread group , Ramp up peridod and Loop count?

I'm new to jmeter I have the following scenario. I want the jmeter to hit the given url, I have 13 such url in a csv file.
I want to hit the url at the rate of 2 requests per second for a given time period of 60 seconds.
In this case how should I specify my thread group, Ramp-up period and Loop count.
I understood the basic like 10 thread with 10 second rampup with a loop count of 1 will run 1 request per second for 10 user. But I'm not sure how to specify when we have 13 such urls.
Atleast any link for the given scenario is appreciated.
I understood the basic like 10 thread with 10 second rampup with a loop count of 1 will run 1 request per second for 10 user
not necessarily, JMeter waits for response from the previous Sampler prior to executing the next one, the configuration means that JMeter will start 1 user each second, it doesn't guarantee 1 request per second.
The easiest way of achieving X requests per second throughput is using Throughput Shaping Timer
Make sure to supply the sufficient number of Threads, i.e. if your application response time is 1000ms - 2 threads should be enough, if it's 2000 ms - you will need at least 2 threads, etc.
There is a special thread group: Concurrency Thread Group which can be connected to the Throughput Shaping Timer via Feedback Function so it will automatically kick off extra virtual users if the current amount will not be enough in order to conduct the required load.

run a thread group after specific time

I am running one scenario for 2 hours in which I am using service which generates the cookie.. and that cookie is getting expired after 30 minutes.
So I want to create a thread group which will run after 30 minutes so that new cookie will get replace with old cookies.
You can setup another thread group with a 30min startup delay.
Add a constant timer with 30min to ensure the delay after the first execution.
Best approach could be to check the expiry with a If Controller and add the requests within the if controller.
To make this simple
Create a thread group with number of threads as 1 with ramp up as 1 second.
Create a loop controller and add loop count as 4.
Create your request under this loop controller and also add constant timer as child of your request as shown below :
Execution flow will be:
First request will get executed . Once this first request gets a response from the server, it will wait for 30 mins. Then this loops again 4 times. You can control the number of execution in the loop count.
The options are in:
Just specify "Startup delay" for the Thread Group:
Add Flow Control Action sampler as the first sampler in the Thread Group and configure it to pause for the half and hour:
Use custom thread group like Ultimate Thread Group (can be installed as a part of Custom Thread Groups bundle using JMeter Plugins Manager) where you can precisely define when and how to start threads:

duration in jmeter thread group

what is the meaning of the duration in jmeter thread group.
I found this is official document saying that is end time while the startup delay is the start time.
But is it the end time since we start executing the test? or since the thread is created?
When I set the 50 threads and duration 1s, the first timestamp in the output file is 1607391972250 (2020-12-08 09:46:12.25), the thread-50 only send HTTP Request 1 in timestamp 1607391973232 (2020-12-08 09:46:13.232). So it cannot be the end time since each thread is created
But when I set 1000 threads, the timestamp of the last several thread will exceed 1s than the timestamp of first thread's first request. it cannot be the end time since the we start executing the test
So what is the real meaning of the duration?
Duration is neither the start time nor the end time but the timespan between the two.
If your total duration is 1 second and your ramp up time is 1 second it might lead to a bit confusion since some of the threads have only just started when the whole test is already over. The duration starts counting when you either hit the "play button" in the GUI or start the test via command line.
Startup delay will mostly make sense if you have several thread groups inside your test plan and want some part of the virtual users to start at a later point for either logical reasons (e.g. thread group A generates forum posts and group B starts searching those forum posts after 1 minute) or for some kind of load shaping (might be achievable within one thread group though). This is relative to the test start.
Anyway JMeter is a tool mostly used for load and performance testing. In this type of testing you will usually have the tests run for minutes or hours. So from my perspective your question is mostly theoretical unless you want to achieve something very specific which you did not further elaborate.
As per Thread Group documentation:
Specify Thread lifetime If selected, confines Thread operation time to the given bounds
Duration (seconds) If the scheduler checkbox is selected, one can choose a relative end time. JMeter will use this to calculate the End Time.
So "Duration" limits the maximum duration of a given single thread, JMeter starts threads within the bounds of the Ramp-Up period.
In your case you have Ramp-Up time set to 1 second and Duration set to 1 second, it means that JMeter will start 50 threads in 1 second (so the last one will be started in 1 second after test start) and then the last thread will be terminated in another 1 second so its total lifetime plus the time required to execute the first sampler if its response time is more than 1 second
You may find Custom Thread Groups easier to use, all of them provide easy configurable visual way of defining the workload, you can install them using JMeter Plugins Manager

Increment user number with JMeter GUI

I would like to execute a loop of HTTP requests with an incrementally number of users.
For example, I want something like that :
1st loop : 1 user
2nd loop : 2 users
3rd loop : 3 users
...
Is that possible with the JMeter GUI ?
Thanks in advance !
You can achieve this effect by using the Stepping thread group plugin
You can gradually increase the number of concurrent users in JMeter. But not in the way you are actually asking ie, every loop / iteration!
Simply - You can not change the thread count within the test once the JMeter test has started running . But you can use variables for the user count and supply to the test before the test starts.
To gradually increase the user count, you can use any of the below thread groups
You can use the regular thread group, ramp-up period. 100 users and 1000 seconds ramp up period, will add 1 user every 10 seconds.
Stepping Thread Group
Ultimate Thread Group
Actually JMeter doesn't allow this, however you can work it around using different approach, for instance if you stick to Requests Per Minute rather than to Virtual Users.
You can use Constant Throughput Timer to set desired initial throughput (i.e. N requests per minute) and increment it by desired factor each Thread Group iteration.
Despite word "Constant" in its name the throughput doesn't have to be constant, it can be a JMeter Variable or Function or JMeter Property.
Reference material:
How to use JMeter's Throughput Constant Timer
Beanshell Server
Throughput Shaping Timer - an advanced version available via JMeter Plugins, has some extra scheduling capabilities.

JMeter: delay between each thread request a sampler

I am working on stress test, but my first sampler floods server with tons of requests with very little amount of time, so I want to make a delay between each thread using request.
Test structure:
Thread1 - Sampler1 (for example: access login form)
Delay (custom seconds)
Thread2 - Sampler1 (for example: access login form)
Delay (custom seconds)
ThreadN - Sampler1 (for example: access login form)
Delay (custom seconds)
Thread1 - Sampler2
Delay (custom seconds)
Thread2 - Sampler2
Delay (custom seconds)
<...>
Synchronizing Timer
All threads realeased with final sampler (this part works)
I tried to put timers as samplers parents or childs. Probably I am missing something, because non of the timers are working for me.
I've found similar problem solutions, but non of the worked for me:
JMeter - sharing a delay between requests across multiple ThreadGroups
Delays for each thread in Ultimate Thread Group
I would suggest using the stepping thread group via http://jmeter-plugins.org/wiki/SteppingThreadGroup/.
In the 'thread scheduling parameters' section, you'll note you're able to specify the maximum number of threads to run at peak, but you're also also to slowly instantiate threads as you need them.
Very plainly, the setup below says "When I run this test, I'm eventually going to want 100 threads, but when I first start the test, wait 15 seconds, then only start 10 threads. Then add another 10 threads every 120 seconds. Once we reach max threads, keep working for 180 seconds, then slowly peel off 5 threads every 15 seconds.
This should meet your need.
As per your Test Plan description, you can use 1 of the timers mentioned below:
Gaussian Random Timer
Constant Timer
Hope this will help..
Constant Timer would be best option as per your mentioned requirement.
You can use 'Ultimate Thread Group' instead of regular Thread Group. There is 'Initial Delay' in ultimate thread group which will help you to achieve your requirement.

Resources