测量实时 IIS 网站的代码性能瓶颈?
在我的开发环境中非常了解和使用.NET内存和性能分析器(例如RedGate的ANTS Profiler),但我仍然没有找到在生产服务器上实现这一点的真正方法 。
目前,我偶尔会遇到某个应用程序池的 w3wp.exe CPU 使用率达到 100% 的情况。
查看各种性能计数器,我仍然无法确定真正的原因,因为我无法确定代码的哪一部分发生了高 CPU 利用率。
我已经在实时服务器上尝试过CLR Profiler(没有有意义的结果),我什至可以想象安装 ANTS Profiler 并让它运行几个小时以获得一些测量日志。
为了确保我做得正确,我的问题是:
在生产 IIS 7 Web 服务器上进行一些临时测量以检测代码瓶颈的最佳方法是什么?
Knowing and using .NET memory and performance profilers (like e.g. RedGate's ANTS Profiler) very well in my development environment, I still found no real way to do it on a production server.
Currently I'm experiencing every now and then 100% CPU usage of w3wp.exe for a certain application pool.
Looking at various performance counters, I'm still unable to determine the real cause, since I cannot determine in which part of my code the high CPU utilization takes place.
I've tried CLR Profiler on the live server (with no meaningful result) and I even could imagine installing ANTS Profiler and let it run for hours to get some measurement logs.
Just to be sure I'm doing it right, my question is:
What is the best way to do some ad hoc measurements on a production IIS 7 web server to detect code bottlenecks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
虽然您已经回答了自己的问题,但我只想提一下直布罗陀。
我自己没有使用过它,但我听说过它的好处。
Although you've answered your own question, I just wanted to mention Gibraltar.
I haven't used it myself, but I've heard good things about it.
在 Red Gate 的 ANTS Profiler 论坛中也提出了这个问题,我得到了 来自开发人员的精彩回复:
基本上,他们向我指出了 ANTS Profiler 版本 7 的抢先体验计划 (EAP) 版本。这个有一个被他们称为“连续分析”的功能,它基本上对 IIS 工作进程进行实时跟踪。
我会尝试一下这个工具,因为它似乎正是我想要的。
Having asked the question also in the Red Gate's ANTS Profiler forum, I got a great reply from the developers:
Basically the pointed me to the Early Access Program (EAP) version of version 7 of ANTS Profiler. This one has a feature that they call "continuous profiling" which basically does a live trace of a IIS worker process.
I'll give this tool a try since it seems to be exactly what I want to have.
我很想采用 New Relic 的 APM 产品 - 允许您监控真实的用户体验(页面加载时间)、服务器和应用程序本身,
请查看此内容以获取更多详细信息:http://newrelic.com/docs/dotnet/new-relic-for-net
I'd be tempted to adopt something line New Relic's APM product - will allow you to monitor both the real user experience (page load times), servers and the application itself
Have a look at this for more details: http://newrelic.com/docs/dotnet/new-relic-for-net
Sam Saffron(StackoverFlow 创建者之一)不久前创建了一个很棒的命令行工具,但不幸的是已经放弃了它。
我的一个朋友已经分叉了代码,使其能够在 2015 年运行:
https://github.com/jitbit/ cpu-analyzer
(该页面有一个指向 Sam 的博客文章的链接,解释了如何使用它)
Sam Saffron (one of the StackoverFlow creators) has created a great command-line tool a while ago, but unfortunately has abandoned it.
A friend of mine has forked the code to make it work in 2015:
https://github.com/jitbit/cpu-analyzer
(the page has a link to Sam's blog post explaining how to use it)