IIS 上的大量请求超时
我有一个相当繁忙的网站,每月浏览量约为 1000 万次。
我的一个应用程序池似乎堵塞了几个小时,我正在寻找一些有关如何解决该问题的想法..?我怀疑它不知何故耗尽了线程,但我不确定如何追溯确定这一点..?据我所知:
- 该网站从未“宕机”,但大约 90% 的请求开始超时。
- 我可以看到大量“HttpException - 请求超时”。在中断期间的日志中,
- 我找不到任何可能导致超时的 SQL 错误或代码错误。
- 超时似乎是整个网站范围内的所有页面。
- 有一个页面存在错误,可能会导致该特定页面出现错误。
- 该网站必须重新启动。
该网站是 ASP.NET C# 3.5 WebForms..
可能性:
- 线程耗尽: 我的想法是导致错误的页面可能以某种方式启动堵塞可用线程?
- 全局代码错误:另一种可能性是我的一个静态类在某处存在未被发现的错误。这不太可能,因为以前从未发生过这种情况,而且我找不到这些类的任何日志错误,但这是有可能的。
更新
我现在已经设法在问题发生时追踪到它。页面正在正常加载,但由于某种原因,WebResource.axd 和 ScriptResource.axd 都需要一分钟才能加载。在性能计数器中,我可以看到此时 ASP.NET 请求排队峰值。
I have a fairly busy site which does around 10m views a month.
One of my app pools seemed to jam up for a few hours and I'm looking for some ideas on how to troubleshoot it..? I suspect that it somehow ran out of threads but I'm not sure how to determine this retroactively..? Here's what I know:
- The site never went 'down', but around 90% of requests started timing out.
- I can see a high number of "HttpException - Request timed out." in the log during the outage
- I can't find any SQL errors or code errors that would have caused the timeouts.
- The timeouts seem to have been site wide on all pages.
- There was one page with a bug on it which would have caused errors on that specific page.
- The site had to be restarted.
The site is ASP.NET C# 3.5 WebForms..
Possibilities:
- Thread depletion: My thought is that the page causing the error may have somehow started jamming up the available threads?
- Global code error: Another possibility is that one of my static classes has an undiscovered bug in it somewhere. This is unlikely as the this has never happened before, and I can't find any log errors for these classes, but it is a possibility.
UPDATE
I've managed to trace the issue now while it's occurring. The pages are being loaded normally but for some reason WebResource.axd and ScriptResource.axd are both taking a minute to load. In the performance counters I can see ASP.NET Requests Queued spikes at this point.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我首先要尝试的是 Sam Saffron 的 CPU 分析工具,如果有常见的事情发生太多/太长时间,它应该给出指示。部分原因是它不涉及任何改变;只需在服务器上运行它即可。
之后,还有各种其他调试工具可用;我们发现一些非常贫民窟的方法可以非常有效地看到时间花在哪里(当然,它只对 10% 的成功结果有效)。
当然,您可以打开服务器分析工具并拖入各种 .NET / IIS 计数器,这可能可以帮助您发现一些事情。
在这三个选项之间,您应该涵盖:
The first thing I'd try is Sam Saffron's CPU analyzer tool, which should give an indication if there is something common that is happening too much / too long. In part because it doesn't involve any changes; just run it at the server.
After that, there are various other debugging tools available; we've found that some very ghetto approaches can be insanely effective at seeing where time is spent (of course, it'll only work on the 10% of successful results).
You can of course just open the server profiling tools and drag in various .NET / IIS counters, which may help you spot some things.
Between these three options, you should be covered for: