duration in jmeter thread group - jmeter

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

Related

I am not able to get Precise Throughput Timer working

I don't know if I have placed the timer at the correct location. I am not able to get Precise Throughput Timer working.
Any JMeter component needs to be placed according to JMeter Scoping Rules
How do you expect the timer to "work" given you have only one thread and one iteration in the Thread Group especially given your test finishes in 500 milliseconds and you configured the test duration as 500 seconds
If you want to limit your test throughput to 1 request per second for 1 thread and 1 iteration only - I can only think of introducing pacing as none of the existing timers won't be able to do this given that short test duration

JMeter: how to stop the whole performance test after a defined time

I'd like to, independently of any other config regarding amount of threads, ramp up time or anything else, just stop the test if it has been running for more than, for example, 2 hours.
Currently you have in Thread Group Scheduler Checkbox, when you click it
You can define Duration in seconds,
In your case for 2 hours enter 7200 (60 *60 *2)
Another option is putting all requests in Runtime Controller with similar value.
You can also do scripting in While Controller with check time (similar to Dimtri T answer):
${__groovy(${__time(,)} - ${TESTSTART.MS} < 7200000,)}

How to use multiple scenarios in jmeter

I have to test ramping up 1 user every minute for 10 minutes and then then ramping up 20 users ever minutes for next 10 minutes with jmeter. I tried to search on internet, seems like I need to use ultimate thread? If so can someone please give me an example of above scenario?
You can use multiple regular thread groups and in Test Plan,you can select Run thread Group consecutively.
Ultimate Thread plugin allows fine grained control of user threads. It will certainly achieve the concurrency pattern you're looking for. You can also start a thread group delayed with just out-of-the-box Jmeter though:
Use 2 thread groups, and set the required ramp up rates for each thread group. Since you need the second thread group to kick in 10 minutes after the test starts, add a startup delay of 600 seconds.
The relevant jmeter documentation is in Section 4.1 here:
Version 1.9 introduces a test run scheduler. Click the checkbox at the bottom of the Thread Group panel to reveal extra fields in which you can enter the start and end times of the run. When the test is started, JMeter will wait if necessary until the start-time has been reached. At the end of each cycle, JMeter checks if the end-time has been reached, and if so, the run is stopped, otherwise the test is allowed to continue until the iteration limit is reached.
Alternatively, one can use the relative delay and duration fields. Note that delay overrides start-time, and duration over-rides end-time.
It is possible to do with 1 ultimate thread group.
Your setup should be as given below. You did not mention the test duration. I assumed it as 3600 seconds.
1st Row : We will have 10 threads in 600 seconds by starting a thread every min.
2nd Row: We will have additional 200 threads (ignoring the first 10 threads), in the next 600 seconds by starting 20 threads every 1 min.
We need a wait for 600 seconds in the second row which is update in Initial Delay field for the first row to complete.

Constant Throughput Timer 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.

Listener for total completed threads over time

I'm new in JMeter, my question is if there is a listener that records "Total" threads over time available, or how can I create it. By saying "Thread" I mean the whole process inside the thread, PER USER. for example, if a thread contains 10 virtual users and approximately finish one loop in one minute, therefore I have 10 total in first minute, 20 in minute 2, and so on.
For example, I want to know how many times a thread was run at the end of test or at a certain time.
I just defined a unique reference name for each individual counter and then added a Beanshell PostProcessor at the Thread's end. Counter start was set as 1 with Increment of 1 (Duh!)
In the Beanshell PostProcessor, set the Parameters box as ${your_counter_reference} and an easy script to see the number in the console: System.out.println("counter x:"+ ${your_counter_reference})
When you stop the test, look for biggest number of each thread in the console.

Resources