如何在生产环境中监控基本的.NET 7应用程序性能统计数据?

huangapple go评论52阅读模式
英文:

How to monitor basic .NET 7 app performance stats in production?

问题

In old .NET,我可以使用性能监视器来查看诸如GC集合或线程争用之类的信息,适用于Windows上的任何应用程序。

现在性能计数器不再存在或发生了变化。有人告诉我要使用Visual Studio分析器来获取基本的性能指标。

在没有Visual Studio的机器上应该如何做呢?开发人员不能以任何形式存在,必须对系统管理员可用和可行。

英文:

In old .NET I could use performance monitor to see things like GC collections or thread contention per app anywhere on windows

Now the performance counters not there or changed. I was told to use visual studio profiler to get basic metrics.

How do I do it on machines that don't have visual studio? developers aren't permitted in any form or shape ie must be available and feasible for a system admin

答案1

得分: 1

有一些 dotnet CLI 工具,如:

  • dotnet-counters
    > 用于临时健康监控和初级性能调查的性能监控工具。它可以观察通过 EventCounter API 或 Meter API 发布的性能计数器值。例如,您可以快速监视 .NET Core 应用程序中的 CPU 使用率或抛出异常的速率,以查看是否有任何可疑情况,然后再深入使用 PerfView 或 dotnet-trace 进行更严重的性能调查。

  • dotnet-monitor
    > 全局工具是一种在生产环境中监视 .NET 应用程序并按需或使用自动规则在指定条件下收集诊断工件(例如转储、跟踪、日志和度量标准)的方式。

它们不需要在计算机上安装 Visual Studio(尽管需要安装 SDK)。

指标收集是一个广泛且相当复杂的主题。有许多工具可以使生活更轻松,例如 prometheus-netOpenTelemetry,它允许在分布式环境中进行指标收集。

另一种可能性是通过 相应的 API 或使用其他 性能诊断工具 "手动" 将此收集集成到应用程序中。

英文:

There is a number of dotnet CLI tools like:

  • dotnet-counters
    > a performance monitoring tool for ad-hoc health monitoring and first-level performance investigation. It can observe performance counter values that are published via the EventCounter API or the Meter API. For example, you can quickly monitor things like the CPU usage or the rate of exceptions being thrown in your .NET Core application to see if there's anything suspicious before diving into more serious performance investigation using PerfView or dotnet-trace.
  • dotnet-monitor
    > global tool is a way to monitor .NET applications in production environments and to collect diagnostic artefacts (for example, dumps, traces, logs, and metrics) on-demand or using automated rules for collecting under specified conditions.

They do not require installing Visual Studio on the machine (though they require SDK being installed).

Metric collection is a vast and quite complicated topic. There quite a lot of tools making life easier, for example prometheus-net or OpenTelemetry which allows metric collection including distributed environments.

Another possibility is to "manually" integrate this collection into the app via corresponding APIs or using other performance diagnostic tools

huangapple
  • 本文由 发表于 2023年3月31日 17:58:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75897175.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定