Jmeter, Performance Testing

5 must know features of Thread Group in Jmeter

Jmeter

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.


Share This Article :

7 Comments

  1. Ivayla

    Hello,
    I have to perform a load testing with max 3000 users. What are the best scenarios in your opinion?
    Thanks in advance!
    Ivayla

  2. Please clarify me the below

    What is the best load variation policy(Ramp up or constant load) and why?

  3. Ravi

    Dear Sir:

    Could you kindly clarify few JMeter questions…

    1. What is the criteria for setting the ramp up time for 100, 200, 300, 400, 500 users etc? I am using 10,20,30,40,50 respectively. Please let me know if I am correct?

    2. What is the best among.. 100 users with 10s ramp-up with 1 loop-count vs 20 users with 2s ramp-up with 5 loop-count (in both cases total thread are 100)?

    Thanks,

    • Rishil Bhatt

      Dear Ravi,

      Please find below my answers:

      – Please refer to what is written in NFR(Non-Functional Requirement).
      – Type of testing (Load, Stress, Spike or Endurance).
      – Strength of the Server on which your application is deployed + Your application’s architecture.

      You should be asking these questions to solve your queries and also to conduct a stable performance testing.

  4. Akanksha Gupta

    Hello,
    I have a query.Please help me out.
    Why the no. of user’s count fall down (Present at the top right corner)
    I have given No. Of threads:- 10
    Ramp up period: 50sec
    User’s count doesn’t reach to 10 and it falls down to 0.

    Another query is that
    Which will give the correct result for load testing Opting ramp up period or Scheduler??

    Thanks in advance

    • Rishil Bhatt

      Hello Akanksha,

      Query 1: You have given Thread Count as 10 & RampUp Time is 50 Seconds. So, 10 users will take 50 seconds to start executing your script. I in your scenario by the time full ramp-up is achieved, threads start ramping down. The reason can be lenght of your Jmeter script w.r.t the ramp up time you provide.

      Solution: First find out how many seconds it take to complete execution for 1 thread. Then, try reducing the ramp-up time.

      Query 2: It is entirely dependent on the type testing you want to carry out(Load, Stress, Spike, Endurance etc.).

      Ramp-Up is the amount of time Jmeter should take to get all the threads sent for the execution.

      Schedular will give you the duration. For example, if you want to run your script for 45 mins, you will need to configure the scheduler.

      Use the appropriate combination of Ramp-up & Scheduler to achieve your requirement. If you still have any confusion, email us at testingjournals@gmail.com

Leave a Reply