Skip to content
Tutorials Center
My learning

Topics

Lesson 7 of 37 ยท Concepts and Setup

Thread Groups and the JMeter Load Model

Understand every Thread Group setting in JMeter (threads, ramp-up, loops, duration, error actions), how to model realistic load and how to shape it with plugins.

The Thread Group is where you decide how much load to create and how it arrives. A badly chosen Thread Group produces a meaningless test: all users hitting at the same millisecond, or a ramp so slow the test ends before the peak. This lesson explains each setting and gives a method for choosing values.

Honesty note. JMeter cannot run here. Setting names match the standard Thread Group of the 5.x series. The runnable blocks are stand-ins that compute and print what a given setting combination would do, so you can plan before you open JMeter.

The Thread Group panel

Add one with Add > Threads (Users) > Thread Group. The key fields:

Field Meaning
Action to be taken after a Sampler error Continue, Start Next Thread Loop, Stop Thread, Stop Test, Stop Test Now
Number of Threads (users) How many virtual users run this group in parallel
Ramp-up period (seconds) Time over which JMeter starts all threads
Loop Count How many times each thread runs the group's samplers; Infinite repeats until stopped
Same user on each iteration Keep cookies and variables between loops (on by default)
Delay Thread creation until needed Create threads only when it is their start time (saves memory in long ramps)
Specify Thread lifetime Enables Duration (seconds) and Startup delay (seconds)

Ramp-up in detail

With 100 threads and a ramp-up of 50 seconds, JMeter starts roughly 2 threads per second. A thread starts, runs its samplers, loops, and stays active until it finishes its loops or the duration ends. Ramp-up does not mean the load reaches 100 users at 50 seconds and then drops: each thread keeps looping afterwards. At second 50 all 100 are active and the "steady state" begins.

Consequently, if each thread loops only once and each loop takes 2 seconds, then the early threads are finished before the later ones even begin, and you never reach 100 concurrent users. To hold a steady state, either use Infinite loops with a Duration, or use enough loops.

Duration instead of loop count

For time-bound tests tick Specify Thread lifetime, set Duration to 600 seconds, and set the loop count to Infinite. Threads loop until the duration expires, then stop. Startup delay postpones the group's start, useful for staggering groups.

flowchart LR
  A["0 s: 1st thread starts"] --> B["ramp-up: threads added evenly"]
  B --> C["steady state: all threads looping"]
  C --> D["duration ends: threads stop"]

A typical shape: ramp up, hold, stop. The hold phase is the part you analyze.

What counts as "concurrent"?

Threads are concurrent only while inside a request or a think-time wait. 200 threads with 10 s think time and 0.5 s response times produce about 19 requests per second, not 200. So choose thread counts by working backward from a target:

users = target requests per second x (response time + think time)

That is Little's Law, from Performance testing basics. The stand-in below does both directions and also computes the ramp-up start times.

JS Stand-in: size a Thread Group from a target rate

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Sampler error actions

What should a thread do when a sampler fails?

  • Continue (default): keep going. Best for load tests, where errors are data.
  • Start Next Thread Loop: abandon the rest of this iteration and begin the next. Good when the rest of a journey makes no sense after a failed login.
  • Stop Thread: this user quits.
  • Stop Test: let running samples finish, then end the whole test.
  • Stop Test Now: kill everything immediately.

During script debugging choose Stop Test, so one error is not repeated thousands of times. For an actual load test choose Continue or Start Next Thread Loop.

Several Thread Groups

You can add many thread groups, for example Browsers (80%), Buyers (15%) and Admin (5%), each with its own thread count and scenario. They start at the same time and run in parallel unless you tick Run Thread Groups consecutively in the Test Plan. A realistic mix of scenarios is more valuable than one big group repeating a single path.

Per-group start offsets use Specify thread lifetime > Startup delay, so the Admin group can begin 5 minutes into the run.

Shaping load with plugins

The standard Thread Group ramps linearly then holds. Real traffic is not a straight line. With the JMeter Plugins Manager you can install:

  • Stepping Thread Group (older name; now Ultimate Thread Group covers it): add 20 users every 60 seconds, to find the knee of the curve.
  • Ultimate Thread Group: a table of rows, each with start delay, initial load, startup time, hold time and shutdown time, so you can build spikes and plateaus.
  • Concurrency Thread Group with the Throughput Shaping Timer: hold a target requests per second instead of a number of users.

Plugins are third-party and must be installed on every machine in a distributed test.

Stand-in: a stepped load profile

This stand-in prints an ASCII plot of users over time for a stepped test, the profile that Ultimate Thread Group would build.

JS Stand-in: stepped load profile

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Watch for the step at which response times jump or errors begin: that is your system's practical capacity.

Common mistakes

  • Loop count of 1 with a long ramp-up: the load never builds.
  • Thousands of threads in GUI mode: use non-GUI mode, and distribute across machines if one load generator cannot cope (see the distributed testing chapter).
  • Choosing users by guess instead of from a target rate and think time.
  • Leaving Same user on each iteration on when you want each loop to look like a fresh visitor (turn it off, and cookies reset).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. 100 threads, ramp-up 50 s. At about what rate does JMeter start threads?

    100 threads over 50 seconds is 2 threads per second.
  2. 2. You want a 10-minute steady test. Which settings are the most direct?

    Infinite loops with a Duration keeps threads running until the time is up.
  3. 3. Which error action is best while debugging a script?

    Stop Test halts at the first failure so you can inspect it instead of generating thousands of repeats.
  4. 4. Which plugin-based approach holds a target requests-per-second rather than a user count?

    Together these let you shape throughput over time instead of only setting thread numbers.

Summary

  • Thread Group fields: threads, ramp-up, loop count, duration, startup delay and the sampler error action.
  • Threads keep looping after ramp-up; use Infinite loops plus Duration for a steady phase.
  • Pick the user count from target rate x (response + think time).
  • Use several Thread Groups for a realistic scenario mix; use plugins for steps, spikes and fixed throughput.
  • Debug with Stop Test, load test with Continue.

Next: Config Elements and Defaults