【发布时间】:2017-07-31 13:24:04
【问题描述】:
我的应用程序已投入生产一段时间,它运行了一些经典的 asp 和 asp.net 4.5 代码。
环境:Windows 2008 R2 服务器 两台服务器,负载均衡,在proc Session中,从system.web命名空间内置http缓存
随着最新的部署,应用程序开始消耗大量内存,并且正在找出内存使用情况。
我为高内存场景捕获了一个大内存转储,我正试图一一找出内存使用情况。
!address -summary
--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free 448 c9b0400 ( 2.151 Gb) 78.79%
<unclassified> 2150 21b4a0000 ( 1539.289 Mb) 62.06% 13.17%
Image 1367 d593000 ( 213.574 Mb) 24.58% 5.21%
Stack 354 7385000 ( 115.520 Mb) 13.29% 2.82%
TEB 118 76000 ( 472.000 kb) 0.05% 0.01%
ActivationContextData 8 f000 ( 60.000 kb) 0.01% 0.00%
CsrSharedMemory 1 5000 ( 20.000 kb) 0.00% 0.00%
--- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_PRIVATE 1803 1f4b9000 ( 500.723 Mb) 57.63% 12.22%
MEM_IMAGE 2116 121f0000 ( 289.938 Mb) 33.37% 7.08%
MEM_MAPPED 79 4e43000 ( 78.262 Mb) 9.01% 1.91%
--- State Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_FREE 448 c9b04000 ( 3.151 Gb) 78.79%
MEM_COMMIT 3151 23a5d0000 ( 1570.363 Mb) 65.64% 13.93%
MEM_RESERVE 847 12a8f000 ( 298.559 Mb) 34.36% 7.29%
--- Protect Summary (for commit) - RgnCount ----------- Total Size -------- %ofBusy %ofTotal
PAGE_EXECUTE_READ 259 f091000 ( 240.566 Mb) 27.69% 5.87%
PAGE_READWRITE 1377 c80f000 ( 200.059 Mb) 23.02% 4.88%
PAGE_READONLY 679 4657000 ( 70.340 Mb) 8.10% 1.72%
PAGE_READWRITE|PAGE_WRITECOMBINE 17 2016000 ( 32.086 Mb) 3.69% 0.78%
PAGE_WRITECOPY 311 e9f000 ( 14.621 Mb) 1.68% 0.36%
PAGE_EXECUTE_READWRITE 212 921000 ( 9.129 Mb) 1.05% 0.22%
PAGE_READWRITE|PAGE_GUARD 236 239000 ( 2.223 Mb) 0.26% 0.05%
PAGE_EXECUTE_WRITECOPY 60 157000 ( 1.340 Mb) 0.15% 0.03%
--- Largest Region by Usage ----------- Base Address -------- Region Size ----------
Free 80010000 7fde6000 ( 1.998 Gb)
<unclassified> 25b0000 1d78000 ( 29.469 Mb)
Image 61feb000 f4b000 ( 15.293 Mb)
Stack ce0000 fd000 (1012.000 kb)
TEB ffdf8000 1000 ( 4.000 kb)
ActivationContextData 50000 4000 ( 16.000 kb)
CsrSharedMemory 7efe0000 5000 ( 20.000 kb)
我发现了 GC 堆和地址数据,显示内存使用量很大
0:000> !eeheap -stat
Number of GC Heaps: 1
generation 0 starts at 0x273de070
generation 1 starts at 0x273a1000
generation 2 starts at 0x025b1000
ephemeral segment allocation context: none
segment begin allocated size
025b0000 025b1000 035aff50 0xffef50(167729448)
0ea00000 0ea01000 0f9ffd20 0xffed20(167723848)
19a20000 19a21000 1aa1fe54 0xffee54(167726928)
2a750000 2a751000 2b6fb10c 0xfaa10c(164252288)
263a0000 263a1000 26df1224 0xa50224(108139888)
273a0000 273a1000 274a4c70 0x103c70(10640488)
Large object heap starts at 0x035b1000
segment begin allocated size
035b0000 035b1000 04307138 0xd56138(139840568)
1dc60000 1dc61000 1e580050 0x91f050(95642408)
20490000 20491000 206cc878 0x23b878(23409848)
Total Size: Size: 0x63ab464 (104510564) bytes.
------------------------------
GC Heap Size: Size: 0x63ab46445 (1045105648) bytes.
还有dumpheap stat(它没有显示一个特定的对象使用了所有的内存,而是很多对象(我的猜测)
05ef4e70 1615 516800 DevExpress.XtraEditors.ViewInfo.TextEditViewInfo
66418298 11091 763524 System.Windows.EffectiveValueEntry[]
7219a874 24397 780704 System.EventHandler
7219f680 10866 918152 System.Int32[]
6592dc98 9502 932360 System.Xaml.XamlNode[]
05ab1bf4 7180 1091360 DevExpress.Utils.AppearanceObject
05ffd498 2010 1101480 Infragistics.Win.UltraWinGrid.UltraGridColumn
72198390 19429 1165740 System.Reflection.RuntimeMethodInfo
721a12a4 4261 1199184 System.Collections.Hashtable+bucket[]
7219dc28 23649 1474820 System.Object[]
721a2518 13502 7978588 System.Byte[]
7219d834 237668 15219668 System.String
003aa9b0 45181 37740118 Free
Total 1282570 objects
Fragmented blocks larger than 0.5 MB:
Addr Size Followed by
2b3cc938 0.5MB 2b454220 DevExpress.Xpo.Helpers.ObjectRecord
2b454248 0.8MB 2b5295d8 DevExpress.Xpo.Helpers.ObjectRecord
2b6680b0 0.6MB 2b6f9e18 DevExpress.Utils.AppearanceObject
请注意,我从上面的命令中删除/编辑了一些对象名称(因为它是公司特定的,但我认为你有整体想法)
我们在会话和缓存中存储了大量数据,并想检查为 asp.net 缓存和会话数据存储了多少。看到这个的最佳方式是什么?
【问题讨论】:
-
您目前在哪里存储会话?进程内、状态服务还是 SQL?如果可以切换到 SQL,则可以直接从数据库表中测量会话数据大小。您显示的数据是否来自专用的 ASP 工作进程(只有一个应用程序的应用程序池)?
-
@mark 您没有添加,您的应用程序运行在多少台服务器上?
-
正在进行会话并使用默认的 httpcontent 缓存(system.web)
-
我还建议切换到状态服务,看看内存压力是否转移到“ASP.NET 状态服务”服务进程。此外,测量“会话计数”性能指标。当系统空闲(默认 20 分钟)时,它会在大多数会话超时后关闭吗?
标签: c# asp.net session memory windbg