Detecting applications which cause Page faults

Over the weekend, I ran an algorithm (All Pair Shortest Path) using Bellman Ford which has a running time of O(n2m). Since the 20,000 node graph was dense, the algorithm ran for four hours with a CPU load of 100% on quad-core processor.

I noticed a significant degradation in performance (prior to getting a good algorithm) due to Page faults within my process. Page faults can degrade performance. There are two types of Page faults: Hard fault and Soft fault.

Soft fault occurs within an application when the application requests for a large amount of memory, and the memory is not available in a continuous block within the physical memory space of the process. So, the process requests for more physical memory or does garbage collection to free up memory.

Hard fault occurs when an application requests resource from memory paged into the physical disk. Hard fault is more expensive because Windows usually swaps stale physical memory from some process into the Paging file (stored in the disk). Hard faults are expensive.

I have got 6 GB of physical memory (RAM). Under ideal conditions, I should get less of Page faults. The Page Faults / sec counter (Memory category) is the sum of both soft and hard faults.  The Page Reads / sec counter (Memory category) gives an indication of the hard faults happening in Memory.

To identify the page faults within an application, there is a performance counter within the Process category, Page Faults / sec. I wrote a simple utility to find the top 5 applications causing the maximum Page faults. Below is the code:

Here is a sample snapshot of the output from the utility:

perf2

Hope this helps detect performance issues in your system.

Leave a Reply

Your email address will not be published. Required fields are marked *