Importance of Pacing & Think Time

Importance of Think Time and Pacing

Think Time and Pacing has 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 has 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 the 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 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 the 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 to 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 the 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 the 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 iteration will be 15 seconds.

The illustration is as follow:

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 purpose.

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:

Leave a Reply

Your email address will not be published. Required fields are marked *