JMeter Thread Groups
JMeter is the most popular open-source tool for load testing and performance measurement of network connected applications.
In this post we will review one of the core elements in JMeter, the Thread Group. A thread group represents a group of users that will execute the same set of actions on your target application. Let's go over all the options available in the Thread Group element and how to use them, as well as compare the standard Thread Group element with the various thread group plugins available in JMeter.
Standard Thread Group
The standard Thread Group element in JMeter is probably the simplest choice and includes some standard options for specifying the number of threads (users), ramp-up period, loop count, and scheduler settings for a load test. Here are all the options available in the standard Thread Group element:
- Action to be taken after a Sampler error: If an error occurs on a thread, let JMeter what to do.
- Continue: Simply continue to the next element (default)
- Start Next Thread Loop: Have the thread go to the next iteration of the thread
- Stop Thread: End the thread immediately. No further elements or iterations will be executed but other threads will continue on.
- Stop Test: Stop the entire test gracefully, waiting on the current element being executed on each thread to finish first
- Stop Test Now: Stop the entire test immediately, not waiting on anything to finish first
- Number of Threads (Users): The number of threads (users) that will be executing the actions in the Thread Group.
- Ramp-Up Period (in seconds): The time it takes for JMeter to ramp up the number of threads to the full amount specified in the "Number of Threads" option.
- Duration (in seconds): The total amount of time to run your test, including the rampup time.
- Loop Count: Instead of specifying a duration you can optionally specify the number of times the actions in the Thread Group will be repeated on each thread.
- Startup Delay (in seconds): The delay in seconds before starting the Thread Group.
Thread Group Plugins
In addition to the standard Thread Group element, JMeter also offers a number of thread group plugins that provide additional functionality. As with all JMeter plugins they can be found at https://jmeter-plugins.org. Here is a brief overview of the different thread group plugins available in JMeter:
Ultimate Thread Group
The Ultimate Thread Group plugin is an enhanced version of the standard Thread Group element that provides additional options for specifying the ramp-up and ramp-down periods, as well as the ability to set a constant throughput rate.
Arrivals Thread Group
The Arrivals Thread Group plugin allows you to specify the number of users that will arrive at your website over a given period of time, as well as the arrival rate (users per second). This can be useful for simulating a more realistic load pattern where users arrive at your website at a steady rate rather than all at once.
FreeForm Arrivals Thread Group
The FreeForm Arrivals Thread Group plugin is similar to the Arrivals Thread Group plugin, but it allows you to specify a custom load pattern using a CSV file. This can be useful if you want to simulate a more complex load pattern where the number of users and the arrival rate vary over time.
Concurrency Thread Group
The Concurrency Thread Group plugin allows you to specify the number of users that will be concurrently active at any given time. This can be useful for simulating a load pattern where the number of active users remains constant over time.
Stepping Thread Group
The Stepping Thread Group plugin allows you to specify the number of users that will be added or removed at each step of the test. This can be useful for gradually ramping up or down the number of users during a test.
Throughput Shaping Timer
The Throughput Shaping Timer plugin allows you to specify the desired throughput rate (requests per minute) for the test and adjusts the think time (delay between requests) accordingly to achieve the desired rate. This can be useful for simulating a constant load on the system.
Concurrency Thread Group
The Concurrency Thread Group plugin is similar to the Concurrency Thread Group plugin, but it allows you to specify the number of users that will be concurrently active at any given time as well as the ramp-up and ramp-down periods.
Comparison
Which thread group plugin you should use depends on your specific needs and the type of load pattern you want to simulate. Here is a comparison of the different thread group plugins and when you might want to use them:
- Standard Thread Group: Use this if you want to specify the number of threads, ramp-up period, and duration.
- Ultimate Thread Group: Use this if you want the additional options for specifying the ramp-up and ramp-down periods and constant throughput rate.
- Arrivals Thread Group: Use this if you want to specify the number of users that will arrive at your application over a given period of time and the arrival rate.
- FreeForm Arrivals Thread Group: Use this if you want to specify a custom load pattern using a CSV file.
- Concurrency Thread Group: Use this if you want to specify the number of users that will be concurrently active at any given time.
- Stepping Thread Group: Use this if you want to specify the number of users that will be added or removed at each step of the test.
- Concurrency Thread Group: Use this if you want to specify the number of users that will be concurrently active at any given time as well as the ramp-up and ramp-down periods.
I hope this post has helped you understand the different options available in the Thread Group element and how to choose the right thread group plugin for your needs. Also note that all of these plugins come pre-installed on any Testable test runner to make life easy. Happy testing!