Is Physical Memory a Bottleneck?

Introduction
Doing analysis during performance testing can be overwhelming if some kinds of light-weight process (e.g. checklist or step by step instructions) are not used. In this article, I will be elaborating on finding if physical memory (RAM) is in scarcity and resulting in bottleneck as a first step of performance analysis process.

Most of the time the performance problem in an application is because of bottleneck presents in following hardware resources –
Processor
Physical Memory
Physical Disk
Network Bandwidth

The hardware resources might not be bottleneck directly but might be resultant of inefficient application(s) design / implementation. Even to find if an application is inefficient, we need to find its effects on hardware resources so that appropriate resolution can be taken during fixing the performance issues.

Among all the above hardware resources, the physical memory is the cheapest to replace and we will analyze it in this article to find if it required to be upgraded.

Memory Bottleneck Indicators

Page Faults
The first step in investigating a memory problem is to measure paging. Although soft page faults (in which pages not in the process’s working set are found elsewhere in physical memory) interrupt the processor, their effects is likely to be negligible.

The best indicator of memory bottleneck is a sustained, high rate of hard page faults. Hard page fault occur when the data a program needs is not found in its working set or elsewhere in physical memory (file system cache), and must be retrieved from disk.

If you suspect a memory shortage, chart the following performance counters –
Memory: Page Faults / sec
Memory: Page Input / sec
Memory: Page reads / sec

If Memory: Page reads / sec value sustained over 5 per second – it is a clear indicator of memory bottleneck.

Paging File
For processes that might require more physical memory than is available, the VMM (Virtual Memory Manager) frees up space in memory by writing less-frequently-referenced pages back to the paging file on disk. As demand for memory increases, the VMM expands the paging file until it runs out of disk space or reaches the paging file reaches its maximum size.

To observe the changing size of the paging file, chart the following performance counters-

Process: Page File Bytes: _Total

It is an instantaneous measure of total number of bytes in the paging file. It should be gradually increasing and plateau at last.

Page Faults, Available Bytes and Process Working Set
When page faults occur, the VMM tries to increase the process working set and in return memory availability starts decreasing. To recover available bytes, the VMM tries to trim process working set and correspondingly page faults increases.

To observe this behavior, chart the following performance counters -
Memory: Page reads / sec
Memory: Available Mbytes
Process: Working Set: _Total

Physical Memory Shortage
Above indicators suggest a memory shortage, but not its cause. It might be possible to have insufficient physical memory to support the operating system, applications and networking services but there is a high possibility of having application(s) that is using memory inefficiently or leaking memory.

To identify if there is really a scarcity of physical memory, it is required to distinguish between a general memory shortage and a memory shortage caused by a particular application.

To achieve this, chart the following performance counters –
Memory: Page Faults / sec
Process (All): Page Faults / sec

If page faults / sec are distributed across all processes and not to one specific process it means it is time to upgrade server with more RAM.

Conclusion
In this article I have explained the first step of performance analysis process i.e. to identify if performance issue is because of shortage of physical memory. The server needs to be upgraded with more RAM and performance run needs to be conducted again for validating the performance issue.

References:
http://technet.microsoft.com/en-us/library/cc749872.aspx

Comments

Popular posts from this blog

Performance Test Run Report Template

Understanding Blockchain

Bugs Management in Agile Project