如何跟踪长时间运行的调用IIS? [英] How to track down long running calls to IIS?

查看:743
本文介绍了如何跟踪长时间运行的调用IIS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的用户是坐立不安。他们不断抱怨毛茸茸的,不可测的东西,尤其是缓慢的,没有给予具体的,当然,这使得它很难追查。

Our users are restless. They keep complaining about woolly, unmeasurable stuff, particularly slowness, without giving specifics, which of course makes it very difficult to track down.

然而,这很可能是他们是对的,那还有一些正在服用的时间太长了回来服务器调用。所以,我想提出一些网站上的嗅探器(我们在IIS7使用ASP.NET MVC 4)将记录时间比的 N 的秒钟转身任何呼叫,或返回不止的 X 的兆字节的数据,所有的请求参数,响应大小,也许一定量的响应数据的一起。

Nonetheless, it is quite possible that they are right, that there are server calls that are taking way too long to come back. So I want to put some kind of sniffer on the web site (we're using ASP.NET MVC 4 on IIS7) that will log any call that takes more than n seconds to turn around, or that returns more than x megabytes of data, along with all request parameters, the response size, and maybe a certain amount of response data.

我还没有线索如何做到这一点,虽然。有什么建议?

I haven't a clue how to do this, though. Any suggestions?

推荐答案

下面是我对这样的:

FRT

虽然可以使用失败请求跟踪记录慢的请求,以我的经验是找出为什么它击中了你的应用程序之前,而不是为什么它的运行速度慢的请求失败更加有用。 9/10倍要简单地告诉你,放缓是在你的code的地方。

While you can use failed request tracing to log slow requests, in my experience is more useful for finding out why a request fails before it hits your application, rather than why its running slowly. 9/10 times its going to simply show you that the slowdown is in your code somewhere.

日志分析器

是的,你可以下载和分析IIS日志。我使用日志分析器蜥蜴的做了分析 - 其对日志分析器一个伟大的GUI。下面是你会如何查询超过1000毫秒慢请求的示例:

Yes you can download and analyze iis logs. I use Log Parser Lizard to do the analysis - its a great gui over log parser. Here's a sample of how you might query slow requests over 1000ms:

SELECT
  To_String(To_timestamp(date, time), 'dd/MM/yyyy hh:mm:ss') As Time,
  cs-uri-stem, cs-uri-query, cs-method, time-taken, cs-bytes,  sc-status
FROM 
  'C:\inetpub\logs\LogFiles\W3SVC1\u_ex140721.log'
WHERE 
  time-taken > 1000 
ORDER BY time-taken desc

New Relic的
我的建议 - 去容易对自己并注册href=\"https://newrelic.com/signup\" rel=\"nofollow\">免费试用一个

New Relic My recommendation - go easy on yourself and sign up for a free trial. No I don't work for them, but I've used their APM product a lot. Install the agent on the server - set it up. In 10 mins you will be amazed at the data you see about the site. Trust me.

它的设计在生产环境中工作,给你什么的运行速度慢,下到数据库查询和堆栈跟踪信息的惊人深度。其纯正的真棒。一旦其设置等待下一个用户投诉,登录并查看痕迹的时间框架。

Its designed to work in production environments and gives you amazing depth of info on what's running slow, down to the database query and stack traces. Its pure awesome. Once its setup wait for the next user complaint, log in and look at traces for the time frame.

当你的亲试用期结束,你仍然可以得到免费的层有价值的数据,但将只保留最后的24个小时。我们购买的许可证-expensive肯定的,但值得每一分钱。为什么?采取以确定根本原因,降低了一个数量级的时候,我们可以通过看什么是慢的请求列表上的数字2,3和4,工作那些得到积极的他们成为大问题之前,最后的警报让我们多更敏感,当事情都走错了。

When your pro trial ends, you can still get valuable data on the free tier, but it will only keep last 24 hours. We purchased licenses -expensive yes, but worth every cent. Why? Time taken to identify root causes was reduced by an order of magnitude, we can get proactive by looking at what is number 2, 3 and 4 on the slow requests list and working those before they become big problems, and finally the alerting makes us much more responsive when things were going wrong.

code将其

您可以滚你自己。这博客使用的mvc ActionFilters做记录。你也可以使用类似于此<一个一个HttpModule href=\"http://stackoverflow.com/questions/17462995/simple-way-to-calculate-response-length-in-mvc4\">post.这种方法的好处是你可以编译和应用程序分别实现模块,然后只在DLL和更新的web.config下降到了接线模块。我会警惕这些方法对于一个非常繁忙的站点。此外,获得详细的适当水平,以充分识别的根源是具有挑战性的。

You could roll you own. This blog uses Mvc ActionFilters to do the logging. You could also use an HttpModule similar to this post. The nice thing about this approach is you can compile and implement the module separately from your application, and then just drop in the dll and update web.config to wire up the module. I would be wary of these approaches for a very busy site. Also, getting the right level of detail to fully identify the root is challenging.

查看请求

正如Appleman1234触及,IIS有一个鲜为人知的功能看当前执行的请求。其方便的为'嘿,它的运行速度慢,现在的处境。您可以使用Appcmd.exe或IIS GUI来做到这一点。您将需要安装请求监视器IIS的功能这个工作。这种方法是确定问题的简陋狭窄,但不告诉你什么在你的控制器运行缓慢。

As touched on by Appleman1234, IIS has a little known feature to look at requests currently executing. Its handy for the 'hey its running slow right now' situation. You can use appcmd.exe or the IIS gui to do it. You will need to install the 'Request Monitor' IIS feature for this to work. This approach is ok for rudimentary narrowing of the problem, but does not show you whats running slowly in your controller.

这篇关于如何跟踪长时间运行的调用IIS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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