Search code examples
jmeterjmeter-5.0

Does the constant timer really add a time beetween each request?


I create a simple test plan with :

  • a thread group
  • a HTTP sampler executing a GET request

My server logs the entry in the controler and the logs contain the log time.

I define 3 users (id threads) and the loop count value is 2.

I try to add a constant timer at the thread group level and at the sampler level and observe the time of logs.

I conclude that the timer add a time after each loop and not after each request as the documentation explains.

Do I miss something ? Do you know how to add a timer after each request ?

The version of JMeter is 5.6.2

To add some details, here are :

  • a sample of the logs
  • an image showing the thread group
  • an image showing the constant timer, the thread delay is 5 000 ms

The first three logs occured at the same second, the next three five seconds later. So the timer is processed after each loop but not after each request.


2024-02-22 22:29:31.724  INFO 19108 --- [http-nio-80-exec-1]    : Entry, user=1
2024-02-22 22:29:31.724  INFO 19108 --- [http-nio-80-exec-4]    : Entry, user=3
2024-02-22 22:29:31.724  INFO 19108 --- [http-nio-80-exec-3]    : Entry, user=2
2024-02-22 22:29:36.771  INFO 19108 --- [http-nio-80-exec-6]    : Entry, user=1
2024-02-22 22:29:36.771  INFO 19108 --- [http-nio-80-exec-2]    : Entry, user=2
2024-02-22 22:29:36.771  INFO 19108 --- [http-nio-80-exec-5]    : Entry, user=3

Thread group

Constant timer


Solution

  • Documentation "explains" that

    timers are processed before each sampler in the scope in which they are found

    Refer to JMeter Scoping Rules article to learn more about the "scope".

    In short:

    • If you add a Constant Timer on Thread Group level - it will create a delay before each Sampler in the Thread Group
    • If you add a Constant Timer as a child of a specific Sampler - it will create a delay before this Sampler only

    If you want to introcude a delay at a specific place - consider using Flow Control Action Sampler instead

    More information: A Comprehensive Guide to Using JMeter Timers