IIS 工作进程使用大量内存?
我的服务器上有一个网站,并且我的 IIS 工作进程始终使用 4GB RAM。 我应该检查什么?
c:\windows\system32\inetsrv\w3wp.exe
I have one website on my server, and my IIS Worker Process is using 4GB RAM consistently. What should I be checking?
c:\windows\system32\inetsrv\w3wp.exe
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我会检查 Gulzar 提到的文档中的 CLR 调整部分。
正如其他发帖者指出的那样,任何实现 IDispose 的对象都应该在完成时调用
Dispose()
,最好使用using
构造。启动
perfmon.exe
并添加这些计数器:I would check the CLR Tuning Section in the document Gulzar mentioned.
As the other posters pointed out, any object that implements
IDispose
should haveDispose()
called on it when it's finished with, preferably using theusing
construct.Fire up
perfmon.exe
and add these counters:请查看调整 .NET 应用程序性能中有关解决内存瓶颈问题的部分
check the section on troubleshooting memory bottlenecks in Tuning .NET Application Performance
创建 w3wp 进程的小型转储并使用 WinDbg 查看内存中的对象。 Microsoft 的 IIS 支持团队每当遇到此类问题时都会这样做。
Create a mini-dump of the w3wp process and use WinDbg to see what objects are in memory. This is what the IIS support team at Microsoft does whenever they get questions like this.
如果您有权访问源代码,您可能需要检查任何实现 IDisposable 的对象是否在
using
语句中被引用,或者在您使用完它们后是否被正确处置。Using
是一个 C# 构造,但基本思想是在完成后释放资源。另一件需要检查的事情是大对象被放入“进程中”会话状态或缓存中。
If you have access to the source code, you may want to check that any objects that implement IDisposable are being referenced inside
using
statements or being properly disposed of when you are done with them.Using
is a C# construct, but the basic idea is that you are freeing up resources when you are done.Another thing to check on is large objects getting put in the "in process" session state or cache.
更多细节肯定会有帮助。 应用程序池中有多少应用程序正在运行? 池中是否有 ASP.NET 应用程序?
如果您正在运行 ASP.NET,请仔细查看会话和缓存变量中存储的内容。 使用 PerfMon 检查发生了多少次第 0、1 和 2 代收集。 小心将 UI 元素存储在会话状态或缓存中,因为这将阻止收集整个页面实例以及页面实例的所有子实例。 最后,检查您是否进行了大量的字符串连接。 由于 .NET 字符串是不可变的,这可能会导致大量对象实例化。 考虑使用 StringBuilder 来代替。
More details would definitely help. How many applications are running inside the application pool? Are there ASP.NET applications in the pool?
If you're running ASP.NET, take a good look at what you're storing in the session and cache variables. Use PerfMon to check how many Generation 0, 1 and 2 collections are occurring. Be wary of storing UI elements in the session state or cache since this will prevent the entire page instance and all of the page instance's children from being collected as well. Finally, check to see if you're doing lots of string concatenation. This can cause lots of object instantiations since .NET strings are immutable. Look into using StringBuilder instead.
正如其他人指出的,此问题的常见原因是资源泄漏,win2k3 服务器和 IIS6 也存在一个已知问题 KB916984
As other people noted common cause of this problem is resource leaking, also there is a known issue with win2k3 server and IIS6 KB916984