Resource icon

Littles Law in Performance Engineering

  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

Little’s Law

Little’s law was named after “John Dutton Conant Little” who was an Institute Professor at the Massachusetts Institute of Technology. Little’s law is a generic and simple law which can be applied not only to software systems but to any generic closed system.

Little‘s law states that the average number of requests in the system(closed) is equal to the product of average number of Requests serviced per unit time and the average time each Request stays in the system.

upload_2017-12-5_22-38-50.png




Little‘s law holds valid only under below conditions

- Little‘s law holds good as long as the as the Requests are not created or destroyed within the system.

- It assumes the system to be a stable system (Rate of arrival equals rate of departure)

It applies to any ―black box‖, which may contain any arbitrary set of components. If the box contains a single resource ( e.g.: single CPU or a single system) or if the box contains a complex system ( e.g.: internet, a city full of systems).

Thus, Little‘s law can be applied to a software systems and can be rephrased as - The average number of users in a queuing system N is equal to the average throughput of system X, multiplied by the average response time of system R.

Numarically,

N = R * X

Where,

N = average number of users in a system

X = average throughput or departure rate of users

R = average time spent in the system or response time



Modifying above stated law for performance engineering and adding think time (TT)

N = (R + TT)* X


Uses of Little’s law in performance engineering and testing

1. Used for designing the test (Modelling workload) – Littles law can be used while designing the test to achieve a desired throughput and calculate appropriate think times (wait times) to be placed inside test script.

2. Used for validating the correctness of test – Every performance test should be verified for correctness by applying littles law on to the results.


Some practice questions –

Problem 1 :Customers exit from a bank at an avg. rate of 2/min. They spend an average of 10 min in the bank. What is the average number of customers in the bank at any time? Assume a stable system.

Solution : Rate of input customers = X = 2/min

Time to service = R = 10 Min

By littles law : N=R*X

N= Number of customers inside bank = 10 * 2 = 20 Customers!

Problem 2 – Determine Concurrent Users in a performance test based on following data-

A system at processes 1000 Transactions/Hour with an average response time of 5s per transaction. The average Think Time per user is = 10s. What is the number of concurrent users on the system?



Throughput or X = 1000/3600 = 0.27 TPS (Transactions Per Second)

From Littles Law : N = [R + TT] * X


Applying the equation: N = [ 5 + 10 ] * 1000/3600 = 4.16

The above system has approximately 4 concurrent users inside the system at any given point of time.


Problem 3 – How to validate software Performance Test Results:

Below details were collected during a test for constant load, Predict if the test was correctly executed or not?

Peak User Concurrency = 400

Average Transactional Response Time = 10s

Average User Think Time = 10s

Peak Transactional Throughput ( as recorded by the tool) = 10 TPS

Solution: Try applying littles law to the above results

N = [R + TT] * X

Solving right hand side = [10 + 10] * 10 = 200 Users

This is not equal to left hand side. Hence it can be predicted that something went terribly wrong with this test.
  • Like
Reactions: jagdeep singh
Author
admin
Views
96
First release
Last update
Rating
5.00 star(s) 2 ratings

More resources from admin

Latest reviews

Excellent!!!
Very Useful