RAMP UP in Thread Group of Jmeter - jmeter

I have issue with setting ramp-up in jmeter.
My test scenario described below.
There are 3 thread groups:
Thread Group1 - 2 Users - Ramp up 10
Thread Group2 - 3 users - Ramp up 15
Thread Group3 - 5 users - Ramp up 25
Problem i'm facing with above scenario is the following.
First user of all the thread groups is kicked off at a same time.
But i don't want like that, i want the following:
In first 10 seconds, 2 users of first thread group should kick off.
After 10 seconds to the test, thread group 2 should kick off their users.
After 25 seconds to the test, third group should kick off their users.
I have seen one option in Jmeter that "Run thread groups consecutively" but if i set that thread group 2 will never start until thread group1 users should complete their requests execution.

jMeter Plugins' Ultimate thread group and Stepping thread group give you far more control over threads.

Add a startup delay to second and third thread group:
http://jmeter.apache.org/usermanual/component_reference.html#Thread_Group
This should do the job.
You can put anything in Start Time and End Time as these will be overriden by startup delay and duration.
Also note:
Start Time If the scheduler checkbox is selected, one can choose an absolute
start time. When you start your test, JMeter will wait until the specified start time
to begin testing. Note : The Startup Delay field over-rides this - see below.
Note particularly:
Note: the Startup Delay field over-rides this - see below.

Related

Running thread groups sequentially in Jmeter

I am trying to run a script with two thread groups each for multiple users. script looks like
Test Plan
Thread group 1 (10 users, ramp up period 5 sec and loop count 1)
Samplers
Thread group 2 (10 users, ramp up period 5 sec and loop count 1, thread startup delay 3 sec)
samplers.
both thread groups share some parameters. So I am using Inter thread communication plugin. My requirement is that for first user I want to run thread group1 and then run thread group2 . then start threadgroup1 for second user. Is this possible?
You cannot, an "user" belongs to Thread Group, they don't share any context.
User 1 of Thread Group 1 and user 2 of Thread Group 2 are different beasts.
Normally you should not be passing anything between thread groups, if you need - most probably the test is badly designed and you need to move Samplers under a single Thread Group.
If thread groups "share" some parameters - take a look at User Defined Variables
If thread groups "share" some test steps - take a look at Test Fragments and Module Controller

Need to run threads groups in Jmeter when previous threads group's all threads is started

I have two thread group Thread group 1 and Thread group 2 in my test plan. Thread Group 1 has 15 users and Thread Group 2 has 20 users. Now I want to run my thread group 2 after threads ( 15 users) of Thread Group has been started.
Is there anyway to run like this.
To achieve this: use following steps:
Add multiple Thread Group in your Test Plan.
In this example, Thread Group - One has 10 Threads and Thread Group - Two has 1 Thread
To start Thread of Thread Group 2 after all the Threads of Thread Group 1, make sure you keep following settings in Thread Group 2
Check Scheduler check box
Start Up Delay should be greater than Ramp up period of previous Thread Group
Make sure to enter duration as well, otherwise you will get the error.
Add If Controller to first Thread Group and use the following __groovy() function as the condition
${__groovy(ctx.getThreadGroup().numberOfActiveThreads() == ctx.getThreadGroup().numberOfThreads,)}
Now you have a "trigger" which fires when all the threads defined in Thread Group are started. Now you can use i.e. Inter-Thread Communication Plugin in order to "tell" the 2nd Thread Group that it's good to go. Check out SynchronizationPluginsExample.jmx for reference implementation.
Add Startup Delay to group 2 which is greater than Ramp-Up Period of group 1
Make sure Test Plan Run Test Group consecutively check-box is un checked

Introducing a delay between two thread groups in jmeter

I want to introduce some delay between two thread groups.
My test plan is-
Thread Group 1 -
a. Thread 1
b. Thread 2
c. Thread 3 (loop controller is added as a parent to thread 3. Loop controller is designed to run Forever)
Thread Group 2
My plan is to start thread group 1 and then start thread group 2 after some delay. Once both thread group have started they should keep on running. I need to introduce a delay between thread group 1 and 2.
I have tried 2 methods below, but they did not serve my purpose.
I selected Run Thread Groups consecutively from test plan, and introduced a test Action Sampler at the end of thread group 1 with
Target: All Threads
Action: Pause
Duration: 5000
and added Synchronizing Timer as a child of the Test Action sampler and set Number of Simultaneous Users to Group by to the number of threads (virtual users) in the Thread Group 1.
Simply added a Constant Timer before start of Thread Group 2.
What is a good solution for this?
Your solution 1 is very good however you need to add a Test Action sampler to the very beginning of the Thread Group 2 as your current setup assumes it running in the end of Thread Group 1 like:
Thread Group 1
Wait 5 seconds
Thread Group 2
Adding a Constant Timer between thread groups is absolutely not something you want to do as given you have the constant timer at the same level as Thread Groups it means the delay will be applied to each and every sampler. You need to move the timer to be a child of the first request of Thread Group 2. Timer will execute before the request which seems to be something you're looking for. See Advanced Load Testing Part 3 - Top 4 Timers article to learn more about timers use cases and best practices
And finally probably the fastest and the easiest solution would be setting a Startup delay for 2nd Thread Group. It can be done under "Scheduler" section:
as per the documentation:
If the scheduler checkbox is selected, one can choose a relative startup delay. JMeter will use this to calculate the Start Time, and ignore the Start Time value.

In jmeter, How can manage the execution of thread groups

There are 3 thread groups as threadGroup1, threadGroup2 & threadGroup3. now i need to execute the threadGroup1 - 1 time, threadGroup2 - 5 times & threadGroup3 - 10 times.
please suggest how can achieve above scenario.
As per Thread Group documentation:
Loop Count
Number of times to perform the test case. Alternatively, "forever" can be selected causing the test to run until manually stopped.
So set the following Loop Counts:
threadGroup1 - 1
threadGroup2 - 5
threadGroup3 - 10
Also you can control whether JMeter will execute all Thread Groups at the same time or consecutively upside down using "Run Thread Groups Consecutively" checkbox at Test Plan level
See Running JMeter Samplers with Defined Percentage Probability article for comprehensive information on running thread groups or individual samplers with different distribution values.
You need to set the loop count property.
Setting the loop count to 10 will execute the threadgroup 10 times.
-1 is forever.

How to configure Threads in Jmeter

How to setup delay in jmeter each user Thread Group.
I am trying to run my script Thread group (users) 10,20,30 and 40 and having a delay of 2 min each in them.
How to setup these things in jmeter?
If you want to test your application with 10 users and each user will come after 2 minute delay than pass ramp up as 1200 sec in thread group
The best controller is "jp#gc - Stepping Thread Group". Why it's the best one is, If you use JMeter "Thread Group", we need to change the "Ramp-Up Period" depending on the Threads.
10 User, wee need "Ramp-Up Period" as 20 (1 users for 2 seconds =20/10) to meet you requirements .
20 user, wee need "Ramp-Up Period" as 40 (1 users for 2 seconds =40/20) to meet you requirements .
........etc
If you use "jp#gc - Stepping Thread Group" , we no need to change the "Ramp-Up Period" depending on Thread count.
Just mention "Next, add" :1 threads every 2 seconds,"jp#gc - Stepping Thread Group" will take care Ramp-up irrespective of Thread Count.
You can use Stepping Thread to make your load testing, which helps you to simulate as an apllication used in real time
Just add Constant Timer to your thread group. That's how it is described: "If you want to have each thread pause for the same amount of time between requests, use this timer.".
And if you want to reproduce a special case when you run 30 threads then make a break for 2 mins before next 40 users, then enable "Run thread groups consecutively" option in your test plan settings (top-level element) and add thread with only constant timer between them.
For example if you want to test 40 uesr test with rampup of 10 users.
Each user will take 2 min to rampup. We can use following configuration.

Resources