关于系统性能查证问题,区分soft和hard page fault
一般看到系统卡的话,就是直接去看CPU使用率,或者再看内存相关。要再加上系统不能弹出对话框,不能申请资源什么的,还会去看句柄数
这些都能在任务管理器上完成。
除了这些,还有一些高级的参数,像disk io,page io,memory peak这些,这些参数可以用系统自带的perfmon工具查看。
(貌似也能用windbg的!vm 21和!memusage相关命令看内在相关的)
里面还有相关的process,memory ,network等对象的性能监控

Evaluating Memory and Cache Usage
http://technet.microsoft.com/en-us/library/cc958286.aspx
意思是cache fault不作为性能判断的指标
, the cache counter values do not provide definitive information about bottlenecks. In some cases, cache counters can report low rates of hits or high rates of misses, suggesting that the system is accessing the disk when, in fact, the requested data has been retrieved from memory. This can occur if virtual addresses mapped by the Cache Manager no longer exist, for example, because the file has closed. To obtain more accurate data on I/O bottlenecks, use the Memory\Pages Input/sec counter.
The cache itself can never really have a bottleneck because it is just a part of physical memory. However, when there is not enough memory to create an effective cache, the system must retrieve more data from disk, resulting in I/O operations that can impact overall performance. Such a shortage of cache space can be considered a cache bottleneck.
==================
http://blogs.technet.com/b/askperf/archive/2008/06/10/the-basics-of-page-faults.aspx
The Basics of Page Faults
- Likes
In our last post, we talked about Pages and Page Tables. Today, we’re going to take a look at one of the most common problems when dealing with virtual memory – the Page Fault. A page fault occurs when a program requests an address on a page that is not in the current set of memory resident pages. What happens when a page fault occurs is that the thread that experienced the page fault is put into a Wait state while the operating system finds the specific page on disk and restores it to physical memory.
When a thread attempts to reference a nonresident memory page, a hardware interrupt occurs that halts the executing program. The instruction that referenced the page fails and generates an addressing exception that generates an interrupt. There is an Interrupt Service Routine that gains control at this point and determines that the address is valid, but that the page is not resident. The OS then locates a copy of the desired page on the page file, and copies the page from disk into a free page in RAM. Once the copy has completed successfully, the OS allows the program thread to continue on. One quick note here – if the program accesses an invalid memory location due to a logic error an addressing exception similar to a page fault occurs. The same hardware interrupt is raised. It is up to the Memory Manager’s Interrupt Service Routine that gets control to distinguish between the two situations.
It is also important to distinguish between hard page faults and soft page faults. Hard page faults occur when the page is not located in physical memory or a memory-mapped file created by the process (the situation we discussed above). The performance of applications will suffer when there is insufficient RAM and excessive hard page faults occur. It is imperative that hard page faults are resolved in a timely fashion so that the process of resolving the fault does not unnecessarily delay the program’s execution. On the other hand, a soft page fault occurs when the page is resident elsewhere in memory. For example, the page may be in the working set of another process. Soft page faults may also occur when the page is in a transitional state because it has been removed from the working sets of the processes that were using it, or it is resident as the result of a prefetch operation.
We also need to quickly discuss the role of the system file cache and cache faults. The system file cache uses Virtual Memory Manager functions to manage application file data. The system file cache maps open files into a portion of the system virtual address range and uses the process working set memory management mechanisms to keep the most active portions of current files resident in physical memory. Cache faults are a type of page fault that occur when a program references a section of an open file that is not currently resident in physical memory. Cache faults are resolved by reading the appropriate file data from disk, or in the case of a remotely stored file – accessing it across the network. On many file servers, the system file cache is one of the leading consumers of virtual and physical memory.
Finally, when investigating page fault issues, it is important to understand whether the page faults are hard faults or soft faults. The page fault counters in Performance Monitor do not distinguish between hard and soft faults, so you have to do a little bit of work to determine the number of hard faults. To track paging, you should use the following counters: Memory\ Page Faults /sec, Memory\ Cache Faults /sec and Memory\ Page Reads /sec. The first two counters track the working sets and the file system cache. The Page Reads counter allows you to track hard page faults. If you have a high rate of page faults combined with a high rate of page reads (which also show up in the Disk counters) then you may have an issue where you have insufficient RAM given the high rate of hard faults.
OK, that will do it for this post. Until next time …
Additional Resources:
===============================================================
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1687
Page faults are generated when an application tries to use memory that is part of its working set, but can't find it. Page faults can be either hard or soft:
- Hard page faults occur when the page is found in the page file on the hard disk.
- Soft page faults happen when the page is found somewhere else in memory.
Hard page faults involve disk I/O and impact performance. Soft page faults also impact performance, but may not result in heavy performance loss in a physical environment. VMware software does not cause the guest operating system running in the virtual machine to see additional page faults, but VMware software must virtualize the page faults that originate from within the virtual machine. Both soft and hard page faults in a virtual machine cause a context switch into the virtualization layer and some additional processing to virtualize memory management data structures. As on native hardware, hard page faults in a virtual machine also require disk I/O to the page file. For best performance, avoid page faults whenever possible. You can investigate if your Windows application is generating page faults by using the Performance Monitor console (perfmon), which shows you the cumulative number of page faults on the system. Generally, if the rate of paging is slow, then the application is generating hard page faults. You can investigate the paging rate by monitoring the "page faults per second" counter. To invoke perfmon in the Windows guest:
- From the Start menu, click Run.
- Type perfmon in the text box.
When the Performance Monitor console appears:
- Click the + (add counter) button.
- In the Add Counters dialog box:
- Choose Memory from the Performance object drop-down list.
- If it is not already selected, click the Select counters from list radio button.
- Choose the Page Faults/sec counter from the list box.
The Performance Monitor console now graphs the number of page faults per second for the whole system. The Pages/sec counter is also useful for finding hard page fault issues because it shows the rate at which pages are read from or written to disk. You can also use perfmonto view per-process page faults. In the Add Counters dialog box:
- Choose Process from the Performance object drop-down list.
- If it is not already selected, click the Select counters from list radio button.
- Choose the Page Faults/sec counter from the list box.
- Under Select instances from list, choose the processes of interest from the list box.
Additionally, Microsoft provides a tool in its Windows Resource Kit called Page Fault Monitor (pfmon). Page Fault Monitor allows you to find which system calls in the application are generating page faults. If your application generates page faults, you should:
- Determine if the page fault is soft or hard (you can use pfmon for this purpose).
- Increase the amount of memory allocated to the application's working set. Some applications, like SQL, allow you to change the working set memory in the configuration.
- Increase the memory allocated to the virtual machine.
- Contact the application vendor to find out if you can prevent the page faults by tuning or modifying the application settings.
If you have an application that generates a large number of page faults, and if your application vendor is interested in working with VMware, please open a support ticket with VMware. Provide complete information about the application and the steps to reproduce the problem. For discussions related to this topic, see the VMware Community Discussion Forums.

浙公网安备 33010602011771号