Perfmon:哪个计数器标识线程正在等待?

fra*_*lic 6 iis asp.net perfmon performance-monitoring

在对 ASP.NET 应用程序进行负载测试时,我们发现页面在高负载下需要 20-30 秒。

我们怀疑这是因为页面正在等待数据库调用或 Web 服务。

是否有特定的性能计数器可以识别 Web 服务器上的此类瓶颈?CPU、内存、磁盘都正常。

还是我们必须使用 perfmon 以外的工具来追踪这个瓶颈?

Tur*_*die 2

如果您怀疑特定应用程序或服务导致内存泄漏,请使用以下计数器调查应用程序的内存使用情况:

Memory\Available Bytes reports available bytes; its value tends to fall during a memory leak.
Memory\Committed Bytes reports the private bytes committed to processes; its value tends to rise during a memory leak.
Process\Private Bytes reports bytes allocated exclusively for a specific process; its value tends to rise for a leaking process.
Process\Working Set reports the shared and private bytes allocated to a process; its value tends to rise for a leaking process.
Process\Page Faults/sec reports the total number of faults (hard and soft faults) caused by a process; its value tends to rise for a leaking process.
Process\Page File Bytes reports the size of the paging file; its value tends to rise during a memory leak.
Process\Handle Count reports the number of handles that an application opened for objects it creates. Handles are used by programs to identify resources they must access. The value of this counter tends to rise during a memory leak; however, you cannot rule out a leak simply because this counter's value is stable.
Run Code Online (Sandbox Code Playgroud)

内存泄漏和非分页池

尽管任何泄漏都很严重,但当涉及非分页池时,内存泄漏尤其值得关注。许多系统服务从非分页池分配内存,因为它们在处理中断时需要引用它,并且当时无法发生页面错误。要确定泄漏是否影响非分页池,请在监控中包含以下计数器:

Memory\Pool Nonpaged Bytes
Memory\Pool Nonpaged Allocs
Process\Pool Nonpaged Bytes
Run Code Online (Sandbox Code Playgroud)

如何识别:存在泄漏的应用程序不断请求更多内存。其特点是以与系统提交字节相同的速率增加进程/页面文件字节;即所有内存承诺都归因于一个进程。可用字节稳步减少,直到系统调出某些内容,然后虚拟字节增加,为更多可用字节腾出空间。当泄漏应用程序的部分内容被调出时,其工作集实际上会减少。请注意,随着可用字节数的减少,每秒页面错误数会增加。

Windows 资源工具包包含一个名为 LeakyApp.exe 的示例程序。这个程序有一个典型的错误,就是不断分配越来越多的内存。

  • 查看以下计数器:Process\Handle Count。另请参阅这篇 MSDN 文章:http://msdn.microsoft.com/en-us/library/ms972959.aspx (2认同)