Skip to content
Tutorials Center
My learning

Topics

Lesson 14 of 37 ยท Test Plans and Samplers

JMeter Timers and Think Time: Constant, Random and Throughput

Make JMeter users behave like humans with timers: Constant, Uniform Random, Gaussian Random, Constant Throughput, Precise Throughput and Synchronizing timers, with scope rules and examples.

Without pauses, a JMeter thread fires the next request the instant the last response arrives. A human reads, thinks and types. The difference is huge: one machine-speed thread can generate the load of dozens of real users. Timers insert delays (think time) or control the request rate, and choosing them well is what separates a realistic test from an accidental denial-of-service.

Honesty note. JMeter cannot run here. Timer names and fields are real. The runnable blocks are stand-ins that compute delays and rates with seeded random numbers so you can compare distributions.

How timers behave

  • Timers run before each sampler in their scope, and delay that sampler by the computed time.
  • A timer under a Thread Group delays every sampler there; a timer under one sampler delays only it.
  • If several timers apply to one sampler, their delays are added.
  • A timer pauses the thread; it does not change what the server sees except the arrival time.
  • Timers are ignored by Run > Start no pauses, handy when debugging.

A timer placed alone with no samplers in scope does nothing. And there is no "timer after the last request" unless you place a Test Action sampler with Pause behind it.

The common timers

Timer Behaviour
Constant Timer Fixed delay in ms. Simple, but unnatural: everyone pauses the same time.
Uniform Random Timer Constant offset plus a random value between 0 and a maximum (equal chances).
Gaussian Random Timer Constant offset plus a bell-shaped random deviation: most pauses near the mean.
Poisson Random Timer Delays modelled on a Poisson distribution, for arrival-like behaviour.
Constant Throughput Timer Pauses threads so the overall rate approaches a target per minute.
Precise Throughput Timer A more accurate rate controller, good for fixed requests per second.
Synchronizing Timer Blocks threads until N have arrived, then releases them together (a spike).
JSR223 Timer A script returns the delay.
BeanShell Timer Older scripting option; prefer JSR223.

Think time that looks human

Use a Uniform Random Timer (Random Delay Maximum 4000, Constant Delay Offset 3000) to produce pauses of 3 to 7 seconds. Or a Gaussian Random Timer (Deviation 1000, Constant Delay Offset 5000) for pauses clustered near 5 seconds. People do not wait exactly 5.000 seconds, and neither should your virtual users: equal pauses make all threads march in step and produce artificial spikes.

Controlling the rate with throughput timers

The Constant Throughput Timer has Target throughput (in samples per minute) and a Calculate throughput based on option: this thread only, all active threads, all active threads in the current thread group, or shared variants. It slows threads down so that the total approaches the target; it cannot speed up a system that is too slow. If you have too few threads to reach the rate, you will not reach it. The target is per minute: 600 per minute is 10 per second.

The Precise Throughput Timer schedules samples with better accuracy for a given throughput and test duration, and it also works well with the Concurrency Thread Group plugin when you need a fixed requests per second shape. Choose it when exact rates matter, such as proving a service handles 50 req/s.

Synchronizing Timer: simulating a spike

Set Number of Simulated Users to Group by to 50 and optionally a timeout. Threads wait at the timer until 50 are present, then all fire at once. This tests a flash-sale button. Use the timeout so a missing user does not block everyone forever, and ensure the thread count is at least the group size, otherwise the group never completes.

Visualizing the delay distributions

JS Stand-in: compare Constant, Uniform and Gaussian delays

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

No output.

The constant timer produces one spike in the histogram, the uniform one a flat plateau between 3 and 7 seconds and the Gaussian a hump around 5 seconds.

Stand-in: how a throughput timer paces threads

A Constant Throughput Timer computes, for each request, how long a thread should wait so that the group as a whole sticks to the target rate. The stand-in below uses that idea: given a target of 120 requests per minute and 4 threads, each thread must send one request every 2 seconds.

JS Stand-in: pacing threads to a target throughput

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

No output.

The last line shows the main limitation: when the pause would be negative, threads cannot go faster, so you need more threads.

Where to put think time

  • Put think time between user actions, not between the sub-requests of one page load (the images and scripts load immediately in a browser).
  • Use a Transaction Controller around one page's requests and a timer between transactions; leave the "include timer duration" option off so reports show response time only.
  • Keep a global timer for steady pacing and add special timers where a scenario step needs long reading time, such as a checkout form.

Common mistakes

  • No timers at all, then reporting capacity in "users" that behave like robots.
  • Constant timers across every thread, causing synchronized waves.
  • Throughput timers with too few threads: the target is never reached and the report looks fine but the real rate is lower.
  • Putting a timer in the Test Plan root so it applies to everything, including setup requests.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A Constant Timer of 2000 ms and a Uniform Random Timer (max 1000 ms) both apply to one sampler. What is the total delay?

    Delays from timers in scope are added.
  2. 2. What does the Constant Throughput Timer do?

    It only slows threads; it cannot create more load than the threads can produce.
  3. 3. Which timer releases a batch of threads simultaneously to simulate a spike?

    The Synchronizing Timer holds threads until the group size is reached, then releases them together.
  4. 4. Why is a Gaussian or Uniform random timer more realistic than a Constant Timer?

    Varied think time spreads arrivals, like real users.

Summary

  • Timers delay the sampler they apply to; multiple timers add up; scope follows the tree.
  • Use Uniform or Gaussian Random Timers for human-like think time.
  • Throughput timers pace the overall rate but cannot exceed what your threads can generate.
  • The Synchronizing Timer creates deliberate spikes.
  • Put think time between user actions, not between the sub-requests of a page.

Next: JDBC, TCP, FTP and Other Samplers