JMeter Thread Group
JMeter Thread Group
The Thread Group is the fundamental element of any JMeter Test Plan. One of first elements that we need to configure to execute a load test is the Thread Group. It defines the number of virtual users (threads) that JMeter will simulate and controls the test execution flow. Each thread that executes the test plan is completely independent of other test threads. Multiple threads can used to simulate concurrent connections to the target server.
Thread Group Configuration
Using Thread Group, we can control the number of users Simulated (Number of threads), the ramp up time (how long it takes to start all the threads), and the number of times to perform the test.
Thread Properties
- Number of Threads (Users): Specifies how many virtual users will be simulated.
- Ramp-Up Period (Seconds): Determines the time taken to reach the full number of threads. A higher ramp-up period gradually increases the load, while a lower value applies it almost instantly.
- Loop Count: Defines how many times each thread will execute the test scenario.
The Thread Group is the entry point to building a performance test, and it allows testers to define the load conditions of the test.
Define Thread Group
To define thread group properties using JMeter GUI
Select Test Plan -> Right click and Mouse hover on Add -> Threads (Users) -> Thread Group, which will create Thread Group element under the selected Test Plan.
or
Edit -> Add -> Threads (Users) -> Thread Group
Example : Understanding Ramp-Up in JMeter
If you configure JMeter with:
- 10 threads (users)
- Ramp-up period of 10 seconds
JMeter will take 10 seconds to start all 10 threads. This means:
- Each thread starts 1 second after the previous one.
- By the end of 10 seconds, all 10 threads will be active and sending requests.
🔹 Formula:
Ramp-up time per thread=Total Ramp-up /Number of Threads
=10 seconds/10 threads=1 second per thread
This ensures a gradual load increase, preventing an instant surge of traffic on the server.