Performance Arithmetic 2

In the previous article, we learned the various performance laws that we can use to do quick and dirty calculations related to performance. In this article, we will learn how to compute the lower bound on response time. Let us start with a little known law.

Suppose you are a manager of a restaurant and you want to know how many people are dining in your restaurant during a certain time period of the day. Suppose you observe that on the average 3 people leave the restaurant every 30 minutes. Furthermore, the average time a customer spends on your restaurant is 1 hour. Let us denote this time as R. We can compute the throughput of the restaurant as

\displaystyle X =3/30
\displaystyle =0.1

person per minute. If the customers will remain for 1 hour (or 60 minutes) on the average, then we can expect to have 0.1 *60 = 6 customers at any time in the restaurant.
This result is very intuitive and is known as Little’s Law:

\displaystyle N = XR

where N is the number of concurrent transactions on the system and R is the response time.

Example 1: A financial institution has a server that computes the financial indicators for the day for all stocks in a certain stock exchange. Suppose there is 5 jobs are always running for this task. If a job is finished for a company, another job is launched to compute the indicators for another company. In other words, there are always 5 jobs doing this task at any given time. If each computation takes about 15 minutes to complete, how may stocks can be processed in a day?

Using little’s law:

\displaystyle N = X_0 * R
\displaystyle X_0 = \frac{N}{R}
\displaystyle = \frac{5}{15 * 60}
\displaystyle = 0.0055


In one day, only \displaystyle 0.055\times 24\times 3600 = 480 stocks can be computed.

In a call center there are 50 operators that each receive a query from a customer. There is a backend database that supports the query of the operator. Let us call the duration of time where the operator receives a call and composes a query to the database as the think time \displaystyle Z. The time that elapses from the time the operator presses the submit button to the time it receives the response from the database as the response time \displaystyle R. We can view the operators as alternating between two states namely “thinking” and “waiting” for response. Let \displaystyle \bar M be the average number of operators in “thinking” state and \bar N be the average number of operators “waiting” for response. Then since an operator can either be “thinking” or “waiting”, we have \bar M + \bar N = M, where M is the number of operators.

Applying little’s law to the operators in “thinking” state, wehave:

\displaystyle \bar M = X_0 Z
\displaystyle \bar N = X_0 R

Adding the two equations we get:

\displaystyle \bar M + \bar N = M
\displaystyle = X_0 Z + X_0 R
\displaystyle =X_0 (Z+R)
Solving for R we get

\displaystyle R=\frac{M}{X0} - Z

This is known as the interactive response time Law.

Example 2: Suppose we were to design a system in which the response time is not to exceed 2 secs and we have 50 operators. If the average think time is 5 minutes, what is the throughput of the system?

From the interactive response law we have:
\displaystyle X_0 = \frac{M}{z+R}
\displaystyle =\frac{50}{5*60 + 2}
\displaystyle =0.1655

or 0.1655 * 24 * 3600 = 14304.64 transactions per day.
We now come to an important consequence of thelittle’s law, that of estimating the lower bound of
the response time of a system.

From Little’s Law, the response time is give by

\displaystyle N =X_0 R
\displaystyle R = \frac{N}{X_0}

The lower bound for R occurs when the throughput is maximum, or when

\displaystyle R \ge \frac{N}{1/\text{max}\{D_i\}} = N \times \text{max}\{D_i\}

Example 3: A webserver serves images and other static files in disk1 with a service time of 15msecs and its dynamic content is put it disk2 which is faster with a service time of 5msecs. On a peak period of 3 hours, there is an average of 50 concurrent users and the CPU utilization is observed to be 35%. A transaction visits disk1 3 times on the average and disk2 2 times. The webserver completes 50000 transactions in 3 hours. Compute the lower bound of the response time of this system.
\displaystyle D_\text{disk1} = S_\text{disk1} V_\text{disk1}
\displaystyle = 0.015 \times 3
\displaystyle =0.045
\displaystyle D_\text{disk2} = S_\text{disk2} V_\text{disk2}
\displaystyle = 0.005 \times 2
\displaystyle =0.01

\displaystyle D_\text{cpu} = \frac{U_\text{cpu}}{X_0}
\displaystyle = \frac{0.35}{50000/(3*3600)}
\displaystyle =0.0756

Since the CPU has the greater service demand,it is the system bottleneck. The maximum throughput this system can attain is 1/0.0756 = 13.22 transactions per second and the response time this throughput is 50 * 0.0756 = 3.78 seconds.


Published by

Bobby Corpus

Loves to Compute!