A Thread Group is the starting point of any Jmeter Test Plan. All the elements of a Test plan must be defined under Thread Group. In simple words, a thread group stores the configuration required for Jmeter script execution.
In this article we are going to discuss about each configuration element of a Thread Group screen. Below are configuration settings you can do under Thread Group:
– Action to be performed after a Sampler hits an error
– Thread Count (Number of Users you want for execution)
– Setting the Ramp-Up Time
– Loop Count (Defined or Forever)
– Scheduler Configuration
1) Action to be performed after a Sampler Error
As the name implies, this option tells Jmeter what to do if the execution hits an error because of sampler failure or assertion failure. Jmeter gives you 5 choices to handle the failure of a sampler, and they are “Continue“, “Start Next Thread Loop“, “Stop Thread“, “Stop Test” & “Stop Test Now“.
By default “Continue” option is selected. Now let’s look at the significance of these options.
– Continue : Jmeter will ignore the error, continue the execution and only affected sampler gets failed in the listener.
– Start Next Thread Loop : Jmeter will ignore the error and continue with the execution of next thread loop.
– Stop Thread : Execution of the current Thread will be stopped, remaining threads will be executed as defined.
– Stop Test : Entire Test execution will be stopped if any sampler hits an error.
– Stop Test Now : Test execution will be stopped abruptly and all currently active samplers will be interrupted to end the execution.
2) Thread Count
Thread Count defines the number of Users you want to simulate for the execution.
3) Setting the Ramp-Up Time
Ramp-Up is the amount of time Jmeter should take to get all the threads sent for the execution. Ramp-Up should be sufficient enough to avoid unnecessary and large work load from the beginning of the test execution.
For example, if Thread Count is 10 and the ramp-up period is 100 seconds, then Jmeter will take 100 seconds to get all 10 Threads up and running. First thread will be sent on 0th second (beginning of the execution) and then each thread will start after 10 seconds(100/10).
4) Loop Count
Using Loop Count you can specify the number of times to execute the Performance Test. You can select check-box “forever”, it will keep on executing same Test script in loop until you manually stop the execution. There is also an option to manually define the loop count.
Now let’s look at some examples to understand Thread Count + Ramp-Up Time + Loop Count combination.
– Scenario 1 : Thread Count = 20, Ramp Up Time (Seconds) = 100 & Loop Count = 1
Every 5 seconds (100/20) one Thread / Request will hit the server. Execution will start with one request at a time.
– Scenario 2 : Thread Count = 20, Ramp Up Time (Seconds) = 100 & Loop Count = 4
Every 5 seconds (100/20) 4 Thread / Requests will hit the server. Once the first thread completes the first round of execution, it will start 2nd loop by executing same HTTP request. Execution lasts until all 20 threads executes all HTTP requests 4 times.
5) Scheduler Configuration
Thread Group provides option to execute you script for specific amount of Time. A Scheduler check-box is located at the bottom of the Thread Group screen which will enable some more options. You can see Duration of Test Plan execution, Startup Delay, Start Time and End Time.
It allows you to configure the specific amount of time as part of the Duration(in seconds). Jmeter will execute the Thread Group for the time you have mentioned in the Duration. After initiation of execution, Jmeter waits for the exact amount of time you have mentioned in the Startup Delay(in seconds). These 2 options override Start Time and End Time.
When the execution starts, Jmeter waits until it reaches the Start Time. At the end or in between of execution cycle, Jmeter checks for the End Time as well. Once the execution time matches the End time it stops the test run.
So, we have covered all configuration elements of Thread Group in Jmeter. For any queries or concerns please post a comment below.