Monday, August 29, 2011

Memory Analysis

Memory analysis is important to improve web application’s performance. To know the shortage of memory you can look at the frequency of the paging.

Paging is the process of moving pages (block of data) from RAM to hard disk to free the memory for other processes. Because of paging you can use more memory than actually exists, but more paging can cause low performance.

Monitoring Memory Usage

To monitor for a low-memory condition, use the following object counters:



  • Memory: Available Bytes
The Available Bytes counter indicates how many bytes of memory are currently available for use by processes.

Low values (e.g. 10 MB) for the Available Bytes counter can indicate that there is an overall shortage of memory on the server or that an application is not releasing memory.
  • Memory: Pages/sec

The Pages/sec counter indicates the number of pages that either were retrieved from hard disk due to hard page faults or written to hard disk to free space in the working set due to page faults.
A high rate for the Pages/sec counter could indicate excessive paging.
  • Memory: Page Faults/sec
Monitor the Memory: Page Faults/sec counter to make sure that the disk activity is not caused by paging.
Page faults/sec is the sum of hard and soft page faults. A soft page fault occurs when then the requested page is found elsewhere in physical memory. A hard page fault occurs when the requested page must be retrieved from disk.

Monitoring Excessive Paging Activity


As we know paging includes disk activity so to monitor paging we can monitor hard disk activities and to do that make sure to track disk usage counters such as the following along with memory counters:
  • Logical Disk\% Disk Time
  • Physical Disk\Avg. Disk Queue Length
If a low rate of page-read operations coincides with high values for % Disk Time and Avg. Disk Queue Length, there could be a disk bottleneck. However, if an increase in queue length is not accompanied by a decrease in the pages-read rate, then a memory shortage exists.