run a thread group after specific time - jmeter

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:

Related

How does jmeter thread group process samplers?

I'm having a question about how the requests are processed,
For example:
I have created a test plan, with one thread group.
Set number of users (thread): 10
Ramp-up period: 20
Loop count: Forever
Within this thread group I have created 5 HTTP requests.
When I hit start, I understand that it starts with 1 user, and by 20th second it will have all 10 users.
Does each sampler (http request) get assigned to 1 user? Is each sampler fired in sequential order? Does it fire parallel requests? I am trying to understand overall working.
JMeter starts threads (virtual users) within the bound of the ramp-up period. In your case JMeter starts with 1 user and adds another user each 2 seconds.
When thread (virtual user) is started it starts executing Samplers upside down (or according to Logic Controllers)
When there are no more samplers left to execute the thread starts over (if the number of loops is > 1), otherwise it is shut down.
With regards to concurrency, it mainly depends on the number of threads and application response time, you can observe how many virtual users were online using Active Threads Over Time listener and the delivered load using Server Hits Per Second. The aforementioned listeners can be installed using JMeter Plugins Manager
Each thread is sequential firing HTTP requests based on your flow
But you are executing 10 threads/users in parallel, so the order of the requests in total isn't sequential, but parallel
If you defined loop count as 1, then each sampler (http request) would get assigned to 1 user,
But you are looping endlessly, so samplers can be executed more than once per user/thread
About Loop Count: (asked in comment)
Loop Count - the number of iterations for each Thread.

Run same Jmeter thread group after certain interval

I am trying to run the same thread group after a certain interval. Example -
JMeter will run thread group A and execute all http requests inside it and let's say for example after 20 sec it will run thread group A again and this loop should carry on until I manually stop the script.
What I have designed right now is something like this-
Thread Group A
While Controller (I gave some condition so that it is always true)
Http request 1
Http request 2
Constant timer (20sec)
but this only puts 20sec delay between each http call.
Replace Constant Timer with the Test Action sampler, keep all defaults and set "Duration" to 20000 milliseconds
Add Syncrhonizing Timer as a child of the Test Action sampler and set "Number of Simultaneous Users to Group by" to be equal to the number of threads in your Thread Group
That's it, synchronizing timer will act as a "rendezvous" point so all your virtual users meet there and wait for 20 seconds together.
You might also be interested in How to Easily Implement Pacing in JMeter in order to be able to configure more complex delay scenarios

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.

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.

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.

Resources