# Pacing Time & Think Time Calculator

As a Performance Engineer, you should be already aware of basic Queuing Theory principles (or atleast Little's law) to validate the test / to calculate the expected throughput of a load test / to calculate Pacing time / Think time for executing load test that meets target throughput,etc.

If not, here is the quick summary about how to use Little's Law.

**As per Little's Law, N = X * (R + Z)**

where,

**N** represents the __ average__ number of jobs in the system

**X** represents the __ average__ throughput (job completion rate)

**R** represents the ** average** time spent by the job in the system

**Z** represents the time delays configured within the job ( Pacing is also another type of delay configured within the job. Include where-ever available)

Though it seems to be very simple calculation, for applying Little's law in Performance testing using metrics available from performance testing tool, there are lot of misinterpretation & confusions around. And a bunch of online calculators are available ( unfortunately most of them are faulty).

While applying Little's Law in Performance testing, enough care should be take to ensure all the units are in equivalent unit of measurement.

For example, If 15 users test is run for 1 hour (steady state load period), providing the system throughput of 10 Transactions/second with average transaction response time as 1 second, where there are 2 transactions in the script with configured think time of 1 second. (assume Pacing time between iteration is set as zero in load test tool).

Here, N = 15 users, X = 10 TPS, Total R = 1+1 =2 seconds , Think Time, Z = 1 second

You need to ensure equivalent units are used by all metrics. If X represents the system throughput as individual transactions per second (X = avg X1 + avg X2), then R & Z also needs to be average response time & average think time of an individual transaction.

Therefore, If X = 10 TPS (This represents total of average throughput of individual transactions in the script). Then R should represent average response time for a transaction, hence R=1 second. Z should represent average think time for a transaction, hence Z = 1 second / 2 transactions = 0.5 second.

Lets apply Little's Law [N = X * (R+Z)] to calculate whether the above test is valid. If the test is valid, left hand side should be equal to right hand side.

**15 = 10 * (1 + 0.5)**

Hence, this confirms the above test is valid.

Now, lets change the unit of measurement. As per the Business Transaction (or use case), there are 2 transactions available in the test script. If X represents average throughput of business transaction [ X = (avg X1 + avg X2) / 2) where X1, X2 of throughput of transaction 1 & 2 respectively], then R & Z also needs to be average response time & average think time of the business transaction or Iteration.

Therefore, If X = 10 TPS (This represents average system throughput expressed in terms of individual transactions in the script which is readily available from any load test tool).

As we know the number of transactions in the script is 2,

Business Transaction Throughput or Iteration Throughput (IPS) = TPS / Number of transactions.

= 10 / 2 = 5 Iterations per seconds (Iterations represents the business transaction)

System Throughput expressed in Iterations per second , X = 5 IPS

Then R should represent average response time of an iteration, hence total R =1 second * 2 transactions = 2 seconds.

Z should represent total configured think time (executed for an iteration), hence Z = 1 second

Lets apply Little's Law [N = X * (R+Z)] to calculate whether the above test is valid. If the test is valid, left hand side should be equal to right hand side.

**15 = 5 * (2 + 1)**

Hence, this confirms the above test is valid.

Little's law can be applied for calculating Pacing time / Think time if other parameters are known.

Remember, Pacing time & Think time are user configured delays in order to meet the target system throughput. If we increase these delays, system throughput will decrease (assuming system is stable state).

If you are interested to calculate exact think time or pacing time, then use below formula :

**N = X * (R + [Z*(No of Trans-1)] + [(P*(No of Iterations-1))/No of Iterations])**

Note : X should be expressed as IPS (not TPS)

Z * (No of Trans-1) represents total think time configured between the transactions

[(P*(No of Iterations-1))/No of Iterations]) represents the pacing time to be configured in load test tool which gets executed between iterations for (No of iterations - 1) times.

**So ****Pacing time P (in seconds) can be derived as**

**[ ( (N / X) - (R + (Z * (No of Trans-1) ) ) ) * No of Iterations ] / (No of Iterations-1)**

Use this underlying formula to calculate the delays to be configured in the script (Think time or Pacing time delays).

You can find more detailed explanation along with real time project case studies (from JMeter & LoadRunner tool results) in our online course "Workload Modelling Essentials for Performance Engineers".

More details about how to apply queuing theory principles in performance testing is available in our online course "Queuing Theory & its applications in Performance Testing".

We do not provide you calculators in our courses, but we provide the concepts & formula to do the calculations yourself !!

Happy Learning !!

## 0 comments