Importance of Pacing & Think Time

Think Time and Pacing have significant importance in Performance Testing. They are very basic terms which are specially used while designing the workload in the workload modelling phase of PTLC (Performance Test Life Cycle). They are used to control the transaction rate during a load test but have significant differences. A new performance tester is always confused between Think Time and pacing. Below are simple one-liner definitions of both the term which makes them understand Think Time and Pacing.

Think Time: The Time between two transactions

Pacing: The Time between two iterations

Think time commands the virtual user (user thread) to pause the business flow in between for the given period of time. To make it more simple; when a virtual user completes one transaction then it waits for some time before starting the next business transaction. This takes into account the time a real user might wait (think) while taking another action on the web page. On the other hand, pacing instructs the virtual user to wait for the given period of time before starting the next business flow cycle (iteration). Many performance testers ignore this testing functionality and allow the virtual user sessions to be spaced after one another almost instantaneously. This is not the best approach to follow since there is always some time gap between two sessions by the same user in the production environment.

Why Think Time?

Think time is used to create a real-world scenario. As explained above it allows the virtual user (user thread) to pause in the business flow while moving from one business transaction to another. A user will never log in, search, place an order, payment and log out within a few seconds. He requires some time to think and do the next action. An average Think Time could be 5-10 seconds for a normal user. Hence always add think time in the load test to simulate the real-world scenario.

Another reason to add think time is to achieve user concurrency on the server. Adding think time increases the duration of the user session on the server. Hence it helps to identify the concurrent user handling capacity of the server.

Why Pacing?

Pacing is used to regulate the rate of requests hitting the server. Using Pacing, you can accurately achieve the desired load as per NFR instead of just mindlessly hammering the server. Correct pacing gives the exact load handling capacity of a server in terms of TPS.

You may see two definitions of Pacing over the internet. One definition states that Pacing is the sum of response time, think time and delay between the iterations. Another definition states that Pacing is the delay time between the iterations. You can choose any definition and use it in Little’s Law carefully.

As per the first definition:

No. of Users = IPS x Pacing
where Pacing = End to End Response Time + Total Think Time + Delay between iterations

As per the second definition:

No. of Users = IPS x (End to End Response Time + Total Think Time + Pacing)
where Pacing = Delay between iterations

Note: PerfMatrix always uses the second definition for workload modelling calculation.

One Liner Tip:
Think Time helps to achieve User Concurrency while Pacing helps to achieve TPS.

Example:

Let’s consider the below non-functional requirements:

No. of users = 6
No. of Transactions per iteration = 5
End to End Response Time = 25 seconds
IPS (Iterations per second) = 0.1

After creating the script add think time in between the transactions. Since there are 5 transactions so 4 think time functions (elements) need to be added. The think time value is decided as 5 seconds. Hence the virtual user will pause its flow for 5 seconds before starting the next transaction.

The total Think Time in an iteration will be 20 (= 5 + 5 + 5 + 5).

Now, we have the following metrics:

No. of users = 6
No. of Transactions per iteration = 5
End to End Response Time = 25 seconds
IPS (Iterations per second) = 0.1
Total Think Time = 20 seconds

Now, apply Little’s law:

No. of Users = IPS x (End to End Response Time + Total Think Time + Pacing)

  • => 6 = 0.1 x (25 + 20 + Pacing)
  • => 6 = 0.1 x (45 + Pacing)
  • => Pacing = (6 / 0.1) – 45
  • => Pacing = 60 – 45
  • => Pacing = 15 seconds

Hence the delay between two iterations will be 15 seconds.

The illustration is as follows:

Think time and Pacing
Think time and Pacing 2

Another important point is Pacing is of two types.

  1. Constant Pacing
  2. Dynamic Pacing

It is always recommended to use dynamic pacing to achieve exact TPS. The reason is iteration response time always varies and in that case, if you use constant pacing then there is a chance to miss the target TPS. Dynamic pacing tries to nullify the impact of changes in response time and maintains a constant TPS rate. The above-given illustration shows constant response time and pacing just for understanding purposes.

The easiest way to calculate Think time and Pacing

Use PerfMatrix Calculators:

  1. Think Time Calculator
  2. Pacing (Delay Between Iterations) Calculator

You may be interested:


5 thoughts on “Importance of Pacing & Think Time”

  1. I have given only TPS and load how can we calculate pacing? Eg TPS is 2 and load is 4 duration of test is 1 hour.

    Thanks,
    Sandhya

    Reply
    • Hi Sandhya,

      Calculate the iteration time (time to complete one iteration) by running the script locally. Add the think time as per the page content (or use 3 seconds) and then calculate the pacing. To get detailed understanding refer to below link:

      Workload Modelling

      Reply
      • sir,
        as per sandhya she has only TPS 2 and load 4 and if we are taking think time 3 sec then also we need total response time to calculate the pacing as per little’s low

        please correct me if i am wrong?

        Reply
  2. Hi, you have mentioned the below in your requirements:
    “No. of users = 6
    No. of Transactions per iteration = 5
    End to End Response Time = 25 seconds
    IPS (Iterations per second) = 0.1”

    Here, is the IPS a given metric? if not, how to calculate the IPS?

    Thanks.

    Reply

Leave a Comment