# Knowledge Base & Community Wiki

## Littles Law – Tutorial I

**Introduction : **Let’s start out by looking at what Wikipedia says about Little’s Law –

In Queuing Theory, a discipline within the mathematical theory of probability,

^{ }Little’s Law is a theorem by Prof. John D Little which states: The long-term average number of customers in a stable systemLis equal to the long-term average effective arrival rate,λ, multiplied by the average time a customer spends in the system,W; or expressed algebraically:L=λW.Although it looks intuitively reasonable, it is quite a remarkable result, as the relationship is “not influenced by the arrival process distribution, the service distribution, the service order, or practically anything else.”

The result applies to any system, and particularly, it applies to systems within systems. So in a bank, the customer line might be one subsystem, and each of the tellers another subsystem, and Little’s result could be applied to each one, as well as the whole thing. The only requirements are that the system is stable and non-preemptive; this rules out transition states such as initial start-up or shutdown.

You can read more about Little’s Law at the following Wikipedia Link.

Simply speaking, Little’s Law basically states that the long-term average number of customers in a stable system N is equal to the long-term average effective arrival rate, λ, multiplied by the average time a customer spends in the system, W or Rt.

i.e. N = Rt * λ or also written as N = (Rt + Z) * λ where Z = Think Time.

You can also read a summary of Little’s Law at the following link on the VisualizeIT Community Wiki & Knowledgebase.

**Types Of Models** : There are various ways we could classify systems i.e. open or closed, stable or unstable, etc., but for purposes of this conversation we’ll stick to classification between CPU based systems or IO based systems. CPU based systems are systems which is defined by the following characteristic –

- Single or multiple Service Counters or CPU’s
- Single Queue for the entire system

IO based systems are defined by the following characteristic –

- Single of multiple Service Counters of IO Devices
- Single Queue per device

Your choice of a CPU or IO model completely changes the Queuing Characteristics of the system. So be careful and select the appropriate type of system.

Please note for IO model’s **CPU = 1** *irrespective of value entered. This assumes that you are modelling for a single IO device. *

**Let’s Look At An Example** : Let’s review the results for the Little’s Law model using the above inputs.

Let’s look at an example to understand how Little’s Law can be applied to a system and how one might use Little’s Law to understand the behavior of a system.

- Throughput (X) = 3
- Service Time (S) in Seconds = 0.5
- Number of CPU’s (M) = 4
- Think Time (Z) = 15

Please note that Input is required * ONLY* for 3 of 4 inputs i.e. U(%), X, M, S(secs). Value for Z(secs) is mandatory.

Generally one has data for the following i.e. Throughput (X), Service Time (S), Number of CPU’s (M) and Think Time (Z). Utilization is generally not known and it’s best that we let the model work out system utilization.

**Interpreting Results** : The resulting plots for this model are:

- Throughput (X) v/s Concurrency (N)
- Utilization (U) v/s Queue Length (Q)
- Throughput (X) v/s Response Time (R)
- Throughput (X) v/s Queue Length (Q)
- Throughput (X) v/s Utilization

The model computes the behavior of the system for an * assumed* gradual increase in Throughput (X). These resulting values are then plot on the graphs presented to you.

Utilization (%) v/s Queue Length (TPS) – The resulting graph very clearly tells us that at 88% utilization you should see a queue starting to build up and ~5.5 requests in your queue i.e. Queue Length = 5.5 . In any sphere of life when dealing with systems i.e. a bank with tellers as processors and customers lining up for services or a fast food store with counters as processors and customers lining up for service, you avoid getting into the Zone of Non Linear Performance. Technically speaking the Zone of Non Linear Performance (ZNLP) is typically the entire region past 75% utilization. You’ll note from the graphs below that once a system has entered the Zone of Non Linear Performance the “Request Queues” begin to increase in size and the Transaction Response times increase.

Throughput (X) v/s Concurrency (N) – The resulting graph tells us that at 7 TPS you should see approximately 115 concurrent users on the system.

Throughput (X) v/s Response Time (R) – The resulting graph tells us that at 7 TPS you will see a response time of ~1.2 seconds. Response times have gone up from 0.5 s i.e. Response Times = Service Time + Zero Wait Time to Response Time = 0.5s of Service Time + 0.7s of Wait Time. As we’ve mentioned before, the Zone of Non Linear Performance (ZNLP) is typically the entire region past 75% utilization. As a system moves through the Zone of Non Linear Performance the “Request Queues” begin to increase in size and the Transaction Response times increases gradually.

Throughput (X) v/s Queue Length (Q) – The resulting graphs tells us that at a Throughput (X) of 7 TPS you will see a queue built up with ~5.5 requests in your queue. As we’ve mentioned before, the Zone of Non Linear Performance (ZNLP) is typically the entire region past 75% utilization. As a system moves through the Zone of Non Linear Performance the “Request Queues” begin to increase in size and the Transaction Response times increases gradually.

Throughput (X) v/s Utilization – The resulting graphs tells us that at a Throughput (X) of 7 TPS you will see the system at ~88% utilization. The system has effectively entered the Zone of Non Linear Behavior with queues starting to build up and Waiting time increasing exponentially. As we’ve mentioned before, the Zone of Non Linear Performance (ZNLP) is typically the entire region past 75% utilization. As a system moves through the Zone of Non Linear Performance the “Request Queues” begin to increase in size and the Transaction Response times increases gradually.

**Analytical Modelling Solution:** VisualizeIT offers access to a bunch of Analytical Models, Statistical Models and Simulation Models. Access to all the Analytical (Mathematical) models is free. We recommend you try out the Little’s Law models at VisualizeIT and drop us a note with your suggestions, input and comments.

**Conclusion :** On any system you want to avoid getting into the Zone Of Non Linear Performance (ZNLP) i.e. > 75% Utilization. This applies not just to IT (Information Technology) systems but generally systems across the board i.e. a bank with tellers as processors and customers lining up for services or a fast food store with counters as processors and customers lining up for service. Use Little’s Law to understand to translate User Concurrency into system performance metrics and expected End User Performance. Little’s Law will allow you to get a quick sense of direction with regards to where you are headed from a Performance standpoint when designing a system.