pnp.gif

How To: Capacity Plan for Web Applications Using Predictive Analysis

J.D. Meier, Prashant Bansode, Scott Barber, Mark Tomlinson

Applies To

  • Performance Testing

Summary

This How To shows you how to perform capacity planning for Web applications using predictive analysis. Predictive analysis applies a mathematical model to historical data to predict future resource utilization of your application.

Contents

  • Objectives
  • Overview
  • Summary of Steps
  • Step 1 – Collect Performance Data
  • Step 2 – Query the Collected Performance Data
  • Step 3 – Analyze the Collected Performance Data.
  • Step 4 – Predict Future Requirements.
  • Resources

Objectives

  • Learn How to Perform Capacity Planning.
  • Learn How to use Predictive Analysis for Capacity Planning.

Overview

Capacity planning is process of anticipating growth of your application and acting before demand becomes critical. Using capacity planning saves time, money, and reputation. One of the approaches "Predictive Analysis" predicts the future capacity requirements by extrapolating from historical and current data. With this approach, you analyze how computer resource usage relates to transaction volumes (or user operations). You can do this by analyzing the
IIS log files to understand your application’s usage and recording performance data to understand resource utilization.

Therefore the important aspect of "Predictive Analysis" is collecting right performance data on the application. The accuracy and integrity of the performance data is basis to the usefulness of the resulting predictions.

As the predictions are based on historical data, it increases the likelihood of success. But it’s important to note that these predictions are not absolute statements but rather indicative pointers of the trend the application is following.

Summary of Steps

  • Step 1. Collect Performance Data
  • Step 2. Query the Collected Performance Data
  • Step 3. Analyze the Collected Performance Data
  • Step 4. Predict Future Requirements

Step 1. Collect Performance Data

The performance data for the application needs to be collected over a period of time. The greater the time duration, the greater the accuracy with which you can predict a usage pattern and future resource requirements.

Depending on your performance objectives related to throughput, latency, and resource utilization there are two methods of collecting performance data.
  1. Instrumenting Applications - Instrumenting the application helps to generate more detailed data about that application’s internal operations, related to your performance objectives.
  2. Selecting Performance Counters - The performance counters are collected to verify that you are able to meet your performance objectives and your service level agreements. For example when you need to measure how many system resources your application consumes, you need to pay particular attention to the following:
  3. Processor. Processor utilization, context switches, interrupts and so on.
  4. Memory. Amount of available memory, virtual memory, and cache utilization.
  5. Network. Percent of the available bandwidth being utilized, network bottlenecks.
  6. Disk I/O. Amount of read and write disk activity. I/O bottlenecks occur if read and write operations begin to queue.
For more information about which counters to look at see "Chapter 15 –Measuring .NET Application Performance" at http://msdn2.microsoft.com/en-us/library/ms998579.aspx

Be careful not to collect more than the required amount of data. Monitoring any application incurs overhead that may not be desirable beyond certain levels for a live application.

Step 2. Query the Collected Performance Data

Query the collected performance data based on what you are trying to analyze. If your application is CPU bound, you might want to analyze CPU utilization over a period of time. For example, you can query the data for the percentage of CPU utilization for the last 40 days during peak hours (9:00 A.M.–4:00 P.M.), along with the number of connections established during the same period.

It is also possible to query segmented data from different, common points in the past; such as month-end processing over the last 12 months. The calculation is still useful to predict the future capacity of the system at future month-end processing dates.

Step 3. Analyze the Collected Performance Data

Before you analyze the historical performance data, you must be clear about what you are trying to predict. For example, you may be trying to answer the question, "What is the trend of CPU utilization during peak hours?"

Analyze the data obtained by querying the database. The data obtained for a given time frame results in a pattern that can be defined by a trend line. The pattern can be as simple as a linear growth of the resource utilization over a period of time. This growth can be represented by an equation for a straight line:

y = mx + b
Where b is the x offset, m is the slope of the line, and x is an input. For the preceding question, you would solve for x given y:

x = (y – b)/m
For the example in Step 1, the trend line is:

y = 0.36x + 53
Where y is the CPU utilization and x is the number of observations, 0.36 is the slope of the line and 53 is % CPU utilization from the day one, hence the offset. Following figure shows the trend for this example.

Predictive Analysis.gif
Trend of CPU utilization

Choosing the correct trend line is critical and depends on the nature of the source data. Some common behaviors can be described by polynomial, exponential, or logarithmic trend lines. You can use Microsoft Excel or other tools for trend line functions for analysis

Step 4. Predict Future Requirements

Using the trend lines, you can predict the future requirements. The predicted resource requirements assume that the current trend would continue into the future.

For example, consider the trend line mentioned in Step 3. Assuming you do not want the CPU utilization to increase beyond 75 percent on any of the servers, you would solve for x as follows:

x = (y – 53)/0.36
Therefore:

x = (75 – 53)/0.36 = 61.11
Based on the current trends, your system reaches 75 percent maximum CPU utilization when x = 61.11. Because the x axis shows daily measurements taken from the peak usage hours of 9:00 A.M. to 4:00 P.M., one observation corresponds to one day and as there are 40 observations in this example, your system will reach 75 percent CPU utilization

61.11 – 40 = 21.11 number of days.

Resources



Last edited Mar 14, 2007 at 11:13 PM by prashantbansode, version 6

Comments

No comments yet.