.NET网站巨大的峰值工作集记忆峰值、巨大、记忆、工作

2023-09-04 01:13:00 作者:Fiee

我有一个asp.net/c# 4.0网站在共享服务器上。

I have an asp.net/c# 4.0 website on a shared server.

操作系统Windows Server 2012中运行IIS 7,具有RAM的处理器和3.29GHz的32GB。

The os Windows Server 2012 is running IIS 7, has 32GB of ram and 3.29GHz of processor.

服务器正在运行陷入困境,现在又,如运行问题RDP'ing和其他PHP网站慢。

The server is running into difficulty now and again, such as problems RDP'ing and other PHP websites running slow.

我们的系统管理员曾建议我的网站作为这些问题的一个可能的内存消耗而引起的。

Our sys admin has suggested my website as being a possible memory hog and cause of these issues.

在任何给定的时间点内存(私人工作集)为2GB,可以达到峰值高达15GB。

At any given time the sites "Memory (private working set)" is 2GB and can peak as high as 15GB.

我跑的试用版的 JetBrains公司dotMemory 在服务器上,连接到该网站的W3wp.exe进程。我第一次使用这个程序,我是一个完整的新手在这里。

I ran a trial version of JetBrains dotMemory on the server, attached to the website's w3wp.exe process. My first time using this program, I am a complete novice here.

我把使用dotMemory两个内存快照。

I took two memory snapshots using dotMemory.

和基本快照的比较可以看这里: http://i.imgur.com/0Jk8yYE。 JPG

And the basic snapshot comparison can be seen here: https://m.xsw88.com/allimgs/daicuo/20230904/6293.png.jpg

从上面的对比可以看出,System.String和BusinessObjects.Item是两个项目与最存活字节

From the above comparison we can see that System.String and BusinessObjects.Item are the two items with the most survived bytes.

在system.string我可以看到,主要的主导存活对象是 System.Web.Caching.CacheEntry与135MB 向下钻取。见截屏: https://m.xsw88.com/allimgs/daicuo/20230904/6294.png.jpg

Drilling down on system.string I could see that the main dominating survived object was System.Web.Caching.CacheEntry with 135MB. See the screengrab: https://m.xsw88.com/allimgs/daicuo/20230904/6294.png.jpg

这使我怀疑我可能缓存太多了?

Which leads me to suspect maybe I cache too much?

我缓存中散发出来我的数据库中的所有数据:HTML页面内容,导航菜单项,关系页面与放大器之间;儿童,使用物品等的 HttpContext.Current.Cache.Insert

I cache all data that comes out of my database: HTML Page Content, Nav-Menu Items, Relationships between pages & children, articles etc. Using HttpContext.Current.Cache.Insert.

通过缓存超时设置为10080分钟。

With the cache timeout set to 10080 minutes.

我的问题:

1 - ?是2GB内存(私人工作集)和峰值高达15GB得多的服务器,32 GB拉姆

1 - is 2GB Memory (private working set) and a peak as high as 15GB to much for a server with 32 GB Ram?

2 - 我有没有用dotMemory正确识别的问题。

2 - Have I used dotMemory correctly to identify an issue?

3 - ?是我的缓存问题

3 - Is my caching an issue?

4 - 可能的其他原因

4 - Possible other causes?

5 - 可能的解决方案。

5 - Possible solutions?

感谢

推荐答案

大容量的内存本身不能减缓程序使用。它可以减缓

Usage of a large amount of memory itself can not slow down a program. It can be slowed down

如果窗户积极使用交换文件。请管理员检查此情况下 如果.NET程序会导致垃圾收集过多(产生过多的存储流量)

您可以看到dotMemory内存的交通信息。不幸的是它不能收集这样的信息,如果它重视程序,收集对象创建堆栈跟踪和存储流量信息的唯一方式是启动程序下dotMemory探查,使相应的设置。

You can see a memory traffic information in dotMemory. Unfortunately it can't gather such information if it attaches to the program, the only way to collect object creation stack traces and memory traffic information is to launch your program under dotMemory profiler, enabling corresponding settings.

BUT! 问题是你不能评价的内存业务量的N高或没有,找到性能问题根的唯一方法使用性能分析器。

BUT! The problem is you can't evaluate is memory traffic amount "N" high or no, the only way to find a root of a performance problem is using performance profiler.

例如JetBrains公司dotTrace可以告诉你,你有多少时间花在编程垃圾收集,并且仅在这是一个瓶颈,你应该使用内存分析器找出交通的根本。

For example JetBrains dotTrace can show you, how much time you program spends in garbage collecting, and only in case this is a bottle neck, you should use memory profiler to find a root of traffic.

结论:首先尝试使用性能分析器找到一个瓶颈。 然后,如果你仍然有一个关于dotMemory问题,问我,我会尽力帮助你:)

Conclusion: try to find a bottle neck using performance profiler first. Then, if you still have a questions about dotMemory, ask me, I'll try to help you :)