iis 7.5 ASP.net挂起请求 [英] iis 7.5 ASP.net hanging requests

查看:775
本文介绍了iis 7.5 ASP.net挂起请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iis网络服务器出现了一些性能问题。它随机挂起,我试图弄清楚如何加速服务器。我在服务器上启用了失败请求跟踪,并将其设置为在请求超过3秒时生成日志。

I am having some performance issues with my iis webserver. It is hanging randomly and I am trying to figure out how to speed up the server. I enabled Failed request tracing on the server and set it to generate a log when the request is over 3 seconds.

生成的日志(xml)不会显示太多但是有紧凑性能日志中的一个点,指示服务器挂起的日志部分。下面是发生大量时间损失的日志部分。

The resulting logs(xml) dont show much but there is a point in the compact performance log that indicates what part of the log the server is hanging on. Below is the part of the log where the large time loss is occurring.

65。 i GENERAL_GET_URL_METADATA PhysicalPath =,AccessPerms =51317:46:32.577

66。 i HANDLER_CHANGED OldHandlerName =,NewHandlerName =ExtensionlessUrlHandler-Integrated-4.0,NewHandlerModules =ManagedPipelineHandler,NewHandlerScriptProcessor =,NewHandlerType =System.Web.Handlers.TransferRequestHandler17:46:32.577

67。 i VIRTUAL_MODULE_UNRESOLVED Name =FormsAuthentication,Type =System.Web.Security.FormsAuthenticationModule17:46:47.771

我不确定Handler改变的是,但是需要很长时间,任何提示在哪里开始寻找都会很棒。

I am not sure what Handler changed is but it is taking a long time, any tips would be great on where to start looking.

推荐答案

这是如果没有任何代码,很难找到解决方案。以下是一些一般的提示/提示,您可以通过ASP.NET应用程序获得出色的性能。

It is hard to come up with a solution without having any piece of code in sight. Here are some general hints/tips you can follow in order to have great performances with an ASP.NET application.


  • 最快的方法要求是首先不要这样做。尝试缓存可以缓存的所有内容。有服务器端缓存和客户端缓存。每个都有自己的用途,但您不仅限于一种类型。

  • 确保不缓存和/或保留任何与请求相关的对象的引用到内存中。 ASP.NET具有有限数量的并发请求,并且在内存中保留请求引用将使服务器在线程用完时挂起

  • 完成后立即关闭请求

  • 请求时客户端不需要的所有内容都应在后台完成。

  • 确保您的内存没有内存泄漏应用。垃圾收集通常是ASP.NET应用程序中挂起的原因。收集垃圾时,所有正在运行的线程都会暂停。对于 Gen 2 垃圾收集尤其如此。您可以启用后台生成2垃圾收集

  • 隔离有问题的代码。使用分析器并查看哪种类型的请求是CPU密集型的。然后深入挖掘并查看请求内部的内容使其变慢。

  • 在任何均衡的应用程序中,对象应该是短暂的并且永远存在。对于ASP.NET应用程序,在请求过程中创建的对象理想情况下应该在该请求中或在下一个GC gen 0期间死亡。

  • 考虑大对象的对象池和初始化时间很长的对象

  • 确保您的应用程序池没有完全崩溃并重新启动(查看IIS日志和/或Windows事件)

  • The fastest way to do a request is to not do it in the first place. Try caching everything that can be cached. There are server-side caches and client-side caches. Each have their own uses, but you are not limited to only one type.
  • Make sure you do not cache and/or keep references of any request-related objects into memory. ASP.NET have a limited number of concurrent requests and keeping a request reference in memory will hang your server if it runs out of threads
  • Close the request as soon as you are done with it
  • Everything that is not needed by the client at the time of the request should be done in the background
  • Make sure you have no memory leak in your application. Garbage Collections are often the cause of hangs in ASP.NET application. When garbage collecting, all running threads are paused. This is especially true for Gen 2 garbage collections. You can enable background generation 2 garbage collections.
  • Isolate the problematic code. Use a profiler and see which type of request is CPU-intensive. Then dig deeper and see what inside that request makes it slow.
  • In any well-balanced application, objects should either be short-lived and live forever. In the case of an ASP.NET application, the objects created during the course of a request should ideally die within that request or during the next GC gen 0.
  • Consider object pooling for large objects and objects that are long to initialize
  • Make sure your app pool doesn't totally crash and restarts (look the IIS logs and/or the Windows Events)

您可以使用一些有用的调试工具:

Some useful debugging tools you can use:


  • LeanSentry 。非常适合诊断ASP.NET服务器挂起

  • windbg 。高学习曲线,但到目前为止,您可以使用最强大的调试工具

  • PerfView 。用于分析I / O或CPU使用情况等ETW事件

  • LeanSentry. Great for diagnosing ASP.NET server hangs
  • windbg. High learning curve but by far the most powerful debugging tool you can use
  • PerfView. Useful for analyzing ETW events like I/O or CPU usage

这篇关于iis 7.5 ASP.net挂起请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆