如何分析已部署给客户的 .NET 应用程序的性能?
我有几个客户,我的 WinForms 应用程序的性能不如其他客户。 我在办公室使用 JetBrain 的 dotTrace,但这并不能帮助我找到客户机器上的瓶颈。 如何分析已部署给客户的 .NET 应用程序的性能? 是否有任何具有可再发行组件的分析工具可以让我生成在将结果(dotTrace 中的快照)返回到完整分析工具之前无法使用的分析结果?
更新:由于NProf可以自由分发,我考虑将其部署到客户的工作站。 我将在这里报告结果。
I have several customers where my WinForms app does not perform as well as at other customers. I use JetBrain's dotTrace here in the office, but that does not help me find bottlenecks on the machines of our customers. How can I profile the performance of a .NET app already deployed to a customer? Are there any profiling tools with a redistributable component that lets me produce profiling results that cannot be used until I bring the results (a snapshot in dotTrace) back to the full profiling tool?
Update: Since NProf is freely distributable, I'm thinking about deploying it to a customer's workstation. I will report the results here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不熟悉 dotTrace,但我在 Visual Studio 环境中使用过 Visual Studio 2008 检测和分析工具,并且我相信它们是随 .NET 3.5 SDK 一起分发的。
VSInstr.exe 工具:
http://msdn.microsoft.com/en-us/library/ms182402。 ASPX
将检测部署的二进制文件。
VSPerfCmd:
http://msdn.microsoft.com/en-us/library/ms182403。 ASPX
可以从检测的应用程序捕获性能数据。
我从未直接且仅从命令行完成过此操作,因此我无法为您提供太多帮助,但我认为这至少对您来说是另一种选择。
I'm not familiar with dotTrace, but I have used the Visual Studio 2008 instrumentation and profiling tools in the context of Visual Studio and I believe they are distributed with .NET 3.5 SDK.
The VSInstr.exe tool:
http://msdn.microsoft.com/en-us/library/ms182402.aspx
will instrument the deployed binary.
VSPerfCmd:
http://msdn.microsoft.com/en-us/library/ms182403.aspx
can capture the performance data from the instrumented app.
I've never done it directly and solely from the command line, so I can't offer you much help there, but I figured this was another option for you, at least.
因此,我认为您可能需要某种衡量效果广告部署时间的方法。 尽管它们很不优雅,但我可能会考虑将性能计数器添加到您的应用程序中。 请参阅System.Diagnostics。 我广泛使用它来监视部署中的应用程序。 我发现分析器虽然很棒,但有时会因其开销而隐藏某些问题。 例如,如果您的应用程序访问数据库并且磁盘速度较慢,导致查询花费更长的时间,这在分析器中可能不会明显,因为应用程序通常运行速度较慢。
对于客户端,如果您的应用程序在安装时不需要管理访问权限,我可能会将性能计数器作为“诊断模式”的一部分,因为安装它们需要管理员访问权限。 您可能希望使用性能计数器来测量诸如数据库和服务调用的持续时间、可以增长的数据结构的大小以及发生的故障数量之类的事情。
我们已经知道您的代码可以正常工作,因为在某些客户设置上它可以正常工作。 因此,请考虑将仪器添加到您的应用程序中。 这是编写可靠软件(如良好的日志记录)的那些不起眼的赌注重要元素之一。 这并不有趣,但在我看来,这是必须要做的。 它通常是唯一能让您了解应用程序在部署中执行的操作的方法。 我当前正在开发的应用程序从 Rev 1 中的大约 20 个性能计数器增加到 Rev 2 中的大约 150 个。我不会一直监控其中的大多数,但为了提醒我注意性能和可靠性问题,它们非常值得花时间。
So I think what you might be needing is some method of measuring performance ad deployment time. As ungraceful as they are I might look at adding Performance Counters to your application. See System.Diagnostics. I have used the extensively to monitor applications in deployment. I have found that profilers while awesome sometimes conceal certain problems due to their overhead. For instance if your application hits a database and the disk is slow causing queries to take longer that might not be apparent in a profiler since the application will be running slower in general.
For the client side if your app does not require administrative access on install I might make perf counters part of a "diagnostics mode" since installing them requires admin access. You would want to put perf counters to measure things like the duration of database and service calls, the size of data structures that can grow and the number of failures that occur.
We already know that your code works since on certain customers setups it works fine. So think about adding instrumentation to your application. It is one of those unglamorous bet important elements of writing reliable software like good logging. It's not fun but in my opinion it needs to be done. It is often the only thing that gives you visibility into what your application is doing in deployment. The current application I am working on went from about 20 perf counters in Rev 1 to about 150 in Rev 2. I don't monitor most of them all the time but for alerting me to performance and reliability problems they have been well worth the time.