Table of Contents
- JMeter Thread Group
- Thread Groups
- Types of thread groups and how to add them
- Options in Thread groups
- Action to be taken after a Sampler Error
- Thread Properties
- Scheduler Configuration
- Which Thread Group Should I Use?
- Thread Group
- bzm – Arrivals Thread Group
- bzm – Concurrency Thread Group
- bzm – Free-Form Arrivals Thread Group
- jp@gc – Stepping Thread Group
- jp@gc – Ultimate Thread Group
- setup Thread Group & teardown Thread Group
JMeter Thread Group
In this article on JMeter thread group, you will learn on what is a thread groups. different types of thread groups, thread group properties, scheduler configuration and most importantly how will you decide which thread groups to use for your performance test execution
Thread Groups
Thread groups is a group of threads executing similar kind of actions during a test execution. Here in JMeter tool each thread represents a virtual user. As part of a performance test execution if you need to design a scenario wherein a set of users performs similar kind of actions then we add thread groups in test plan. Precisely saying thread groups are user groups and if you use JMeter for any kind of performance test execution we need to add thread groups.
Types of thread groups and how to add them
Mentioning 8 different types of thread groups available in JMeter. Few thread groups like thread groups, setUp thread group and teardown thread groups are available as a default option.
JMeter plugins used to add remaining thread group mentioned below.
- Thread Group
- bzm – Arrivals Thread Group
- bzm – Concurrency Thread Group
- bzm – Free-Form Arrivals Thread Group
- jp@gc – Stepping Thread Group
- jp@gc – Ultimate Thread Group
- setup Thread Group
- teardown Thread Group
Right click on Test plan, select add and then select either of these thread groups based on your choice.
Options in Thread groups
- Action to be taken after a Sampler Error
- Thread properties
- Scheduler configuration
Action to be taken after a Sampler Error
Action to be taken after a sampler error is a common option across all the thread groups available in JMeter. Based on option we select here JMeter will decide on the actions to be taken if it encounters with any errors during the execution.
- Continue – To continue with the test execution even in case of any errors
- Start Next Thread Loop – It will stop the currently running thread group and proceed with other thread groups (if any)
- Stop Thread – It will stop the running thread in thread group.
- Stop Test – It will stop the test completely.
- Stop Test Now – Almost the same option available with stop test. The test will stop more abruptly.
Thread Properties
Pattern of distributing the load is based on the options selected in thread properties. Below mentioned are properties available in JMeter thread groups.
- Number of threads (users) – Mention number of virtual users or threads for load distribution
- Ramp up period(sec)-Time in seconds needed to ramp up all the virtual users while running a test. Example if you’re running a test with 100 users and if you give 10 seconds in ramp up period, then all 100 users will be ramping up and running in your test in a time duration of 10 seconds.
- Loop count – Indicates number of times execution iterates. Check the forever option if you want to run the test for a specific duration.
- Same User on each Iteration – Check this option if same set of users to be used during the execution.
- Specify thread lifetime – Total duration of test execution in seconds.
Scheduler Configuration
In scheduler configuration additional information on load distribution and its duration included. Below mentioned are the scheduler configuration available in JMeter thread groups. Scheduler configuration information available totally depends on the thread group chosen for an execution.
- Target Rate (arrivals/min) – Targeted request/sample rate in minutes mentioned here. Target rate represents the sample / request rate in a minute and is not the user rate per minute. This option is available in bzm – Arrivals Thread Group
- Ramp Up Time (min)-Time in minutes it takes to push the request load during the execution. This option is available in bzm – Arrivals Thread Group
- Ramp-up Step Count-Mention total number of steps needed while ramping up the request load. This option is available in bzm – Arrivals Thread Group
- Hold Target Rate Time (min)-This is the total test execution duration. This option is available in bzm – Arrivals Thread Group
- Target Concurrency-Targeted number of concurrent users needed during the test.
- This group will start-Mention the number of users needed during the start of the test. This option is available in jp@gc – Stepping Thread Group
- First, wait for – Wait time in seconds needed before ramping the next set of users. This option is available in jp@gc – Stepping Thread Group
- Then Start – New set of users gradually added. This option is available in jp@gc – Stepping Thread Group
- Next, add – Next set of users added in the time intervals of seconds. This option is available in jp@gc – Stepping Thread Group
- Then, hold load for – Overall test execution duration. This option is available in jp@gc – Stepping Thread Group
Which Thread Group Should I Use?
Based on the way you decide to design the load of the application you can decide to choose the thread group. Including few information on how each thread groups is different from one another. Going through the details on each thread group you can decide to opt either of these thread groups which suits the user load design or pattern.
Thread Group
Thread group is the most commonly used compared to other thread groups available in JMeter. Suppose you want to load test your application by using multiple concurrent users for a specific duration then this thread group can be opted. In this example mentioned below 100 users will ramp up in 10 seconds and the test will run for 1 hour duration.
bzm – Arrivals Thread Group
Bzm – Arrivals Thread Group used if we want to trigger a test with a specific number of request rate rather than number of users . In below example 100 requests simulated every minute and will run for 1 hour duration. Total of 6333 request generated by this thread group. Ideally 6000 requests in 1 hour duration, remaining 333 requests getting added in 5 min ramp up duration.
bzm – Concurrency Thread Group
Bzm – Concurrency Thread Group can be used to simulate concurrency in load. In below example, all 12 users will be ramping up in 2 steps by around 5 minutes and will do the execution for 1 hour duration. The total load test execution duration is 1 hour 5 min which is 1 hour of hold target rate plus 5 minutes of ramp up.
bzm – Free-Form Arrivals Thread Group
This thread group is similar to bzm – Arrivals Thread Group and you can design user load on the basis of total number of requests. Below mentioned user load design will run the test for 1 hour 5 min duration and will generate around 340 requests.
jp@gc – Stepping Thread Group
In this thread group we can ramp up the user load gradually. Step by step progression of user load is possible using stepping thread group. In the below example total of 100 users will be running. 20 users ramp up initially and 10 users added gradually in every 30 seconds. This test will run for a duration of 1 hour 5 min which includes 1 hour steady load with 100 users and 5 min of user ramp up.
jp@gc – Ultimate Thread Group
In JP@GC – Ultimate thread group, load can be designed with many more parameters or inputs. This thread can
be used in designing spike test. In the below example a total of 60 users will simulate the load which starts with an initial delay of 10 sec. The first thread scheduled will run for 600 seconds and second thread scheduled will run for 1 hour duration.
setup Thread Group & teardown Thread Group
Both setup Thread Group & teardown Thread Group are having the same option and is similar to basic thread group. Setup threads are like a prerequisite thread group and executed before the actual test execution.
Teardown thread groups executed post the actual test execution, generally executed for any activities needed after the actual execution. Below mentioned are some use cases of setup and tear down thread groups.
Few use cases of setup Thread Group:
- Extracting User details data set information from database
- Test data loaded as data set to database before load test execution.
Few use cases of Tear down Thread Group:
- Deleting the dataset from database post the load test execution.
- Clearing data from cache server post the load test execution.
Refer this article on JMeter setup Thread group to learn more about setup thread group.
Everything is very open with a precise description of the issues. It was really informative. Your website is very helpful. Many thanks for sharing!