In this tutorial, we will be studying about Thread Groups in JMeter, its different properties and configurations.
A Thread Group in JMeter represents a pool of virtual users performing a set of operations. For example, considering Google search, one set of users will be using the search by text functionality, others will be using News Search, some other smaller section of users might be using search by image functionality. While creating a performance test script, for all these users, we will create different Thread Groups in JMeter with different thread count based on the user distribution across the functionalities. The different types of sampler like HTTP requests are added as child of these Thread Group elements, simulating the requests made by users to the server.
We can launch the Thread Group in JMeter by following the path-
Right Click on Test Plan-> Hover over Threads(Users)-> Click Thread Group
Thread Group Properties
The Thread Group element has a control panel(right pane) that can be use to configure the various parameters in a performance test like - number of virtual users to generate, scheduling of the test, introducing of delays in the test etc.
Now, lets have a closer look at each of the properties or configurations in a Thread Group control panel.
- Name - This is the name of the Thread Group, signifying the action performed by the virtual users e.g. if a Thread Group is scripted to perform login operation then we can have Thread Group name as 'LoginUsers'.
- Comments - This is basically an optional textbox, that should contain the description of the action performed by the Thread Group or any other metadata information.
Configurations inside the "Action to be taken after a Sampler Error" block are used to configure the test for actions performed in case of any sampler error, because of no response from server or any assertion error-
- Continue - In case of sampler error the test should continue.
- Start Next Thread Loop - The test continues with next thread execution.
- Stop Thread - The current thread gets stopped in case of error.
- Stop Test - The thread is stopped gracefully, completing the current sampler request.
- Stop Test Now - Abrupt stopping of thread in case of any error.
Configurations inside the "Thread Properties" block-
- Number of Threads(users) - The number of virtual users to be simulated.
- Ramp-up Period(in seconds) - The total amount of time taken to get all the thread started. For example - if we want each thread to be active in 0.5 seconds and there are total of 20 threads, then Ramp Up time should be 20*0.5 i.e. 10 seconds. We will see the benefit of using Ramp-Up period in our coming posts.
- Loop Count - This is the count of the number of loop iteration performing a set of operations defined inside a thread group.
- Loop Count Forever - When checked, it disables or overrides the loop count value and causes the loop to run infinitely until manually stopped.
- Delay Thread Creation until needed - This is used to delay the thread creation till a value specified in this field(in seconds).
- Scheduler - When checked, the scheduler configurations are enabled(explained below) and considered for scheduling of test at a particular time. Otherwise, the test run as soon as we run the test.
Configurations inside the "Scheduler Configuration" block-
- Duration(seconds) - Duration specifies the duration of the test, once reached the test stops.
- Startup delay(seconds) - On running a Test Script, JMeter will wait for the startup delay specified.
- Start Time - This field is used to specify an absolute value of system time for starting the test, once the test is run. It is considered only if the above 'Duration' field is empty.
- End Time - This field is used to specify an absolute value of system time for ending the test. It is considered only if the above 'Duration' field is empty.
Apache JMeter User Manual