Wednesday, July 23, 2014

Using analytical data for measuring the concurrency




The most important thing as part of requirement gathering for a performance testing engagement is to measure the concurrency that has to be simulated/generated. A performance tester needs to get access to the server logs / Analytical data to perform this action.

Let us take a small example of a restaurant which says they server around 1500 customers a day for lunch, where the lunch hours being 12:00 – 3:00 PM. This translates to 500 customers every hour during their lunch time. Now the key factor here is the average duration of a customer.

If people spend an hour for their lunch, it means that the restaurant has to accommodate 500 people in one slot. Assuming that the average time spent at lunch is 30 minutes, now the restaurant has to accommodate only 250 users. 

Now the number either 500 or 250 is the number of customers having their lunch at the same time, which is also known as concurrency.

This is exactly the same way that we calculate the number of concurrent users on the system. The important factors to be considered while calculating the concurrency are:

  • The average duration of a visitor on the application
  • Total number of visits on a peak day / peak hour

Now to get the above said statistics, one can either configure Google analytics on the application or refer to Web server logs that have the information about the user session start time and end time. The third alternative is to get these statistics from the Business analyst in case if the target load is a forecast or prediction for the future (like the coming thanks giving day / Christmas Eve / Memorial Day/ Super bowl day etc.)

The scientific way of calculating the concurrency is to use little’s law. The little’s law says  The long-term average number of customers in a stable system L is 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.” For more details on little’s law refer wiki (http://en.wikipedia.org/wiki/Little's_law )

The total number of users on a web application can be determined by the average arrival rate (100 users / hour and average time spent in the application 1/10 hours (i.e. 6 minutes). Now the concurrency at any point of time L = 100*1/10 = 10 users.
Hope this information is helpful in determining the target user load for an application.