问题是IIS worker会消耗大量内存。在使用VMMAP检查w3wp进程后,我注意到私有WS的最大组件是托管堆,即GC内存。
此外,我使用性能监控检查了w3wp进程,结果如下:
# Bytes in All Heaps : 32MB
# Gen 0 Collections : 4
# Gen 1 Collections : 3
# Gen 2 Collections : 2
Gen 0 Heap Size 570MB
Gen 1 Heap Size 5MB
Gen 2 Heap Size 26MB
Active Sessions : 4
Gen 0堆大小随着每个新会话的增加而增加。峰值出现在我有4个活动会话(~570MB)的时候。当我有6个会话时,它会减少到~250MB,然后再次增加,直到回收应用程序池(~8-9个活动会话)。
据我所知,Gen 0堆的大小必须非常小(与L2缓存相当),这是触发GC运行Gen 0 GCs的大小。
为什么Gen 0堆这么大?
我有以下环境:
IIS 6.0
The application is Asp.Net WebForms
Application Pool is restricted to 700Mb, and it gets recycled when
I have ~8-9 active sessions, so all session are lost.
.Net Framework v4.0.3
64 bit version of w3wp worker.
I also inspected the application memory using CLR profiler and the
number of Bytes in all heaps are 10-60 mb depending on number of active sessions.
谢谢!
发布于 2014-03-07 22:33:21
http://msdn.microsoft.com/en-us/library/ee817660.aspx
使用WinDbg或任何商业.NET内存分析器,您应该能够查看堆中的对象以及它们是否应该在那里。
常见的原因是没有StringBuilder
的字符串操作和会话中的大对象,如DataTable
。
在你的案例中找到确切的原因并进行补救。
https://stackoverflow.com/questions/22095578
复制相似问题