.NET 中的counters说明(二)

内容纲要

在dotnet中,常用的收集指标有:

  • System.Runtime 计数器
  • Microsoft.AspNetCore.Hosting计数器
  • Microsoft.AspNetCore.Http.Connections计数器
  • Microsoft-AspNetCore-Server-Kestrel计数器
  • System.Net.Http计数器(>=.NET5可用)
  • System.Net.NameResolution计数器(>=.NET5可用)
  • System.Net.Security计数器(>=.NET5可用)
  • System.Net.Sockets计数器(>=.NET5可用)

可以通过下面命令监控想要的指标,比如Microsoft.AspNetCore.Hosting的:

dotnet-counters monitor -n websample --refresh-interval 1 --counters Microsoft.AspNetCore.Hosting也可以更小范围内的监控,--counters 参数[]里的项就是以后每个指标()里的项目,可以用逗号分隔多项指标:

dotnet-counters monitor -n websample --refresh-interval 1 --counters Microsoft.AspNetCore.Hosting[total-requests,requests-per-second]System.Runtime是非常重要的计数器

它负责应用运行的环境资源的收集,比例CPU指标,内存堆指标,线程指标等,接下来看一下具体指标的含义。除部分指标外,都是.net core 3.1。命令:

dotnet-counters monitor -n websample --refresh-interval 1

视图:

指标:

% Time in GC since last GC (time-in-gc)

从上次GC结束后,当前GC 时间占这段周期的百分比

Allocation Rate (alloc-rate)

每秒托管堆分配量(B)

CPU Usage (cpu-usage)

 CPU 使用率

Exception Count (exception-count)

每秒异常数

GC Heap Size (gc-heap-size)

GC 堆分配量(MB)

Gen 0 GC Count (gen-0-gc-count)

 每秒0 代 GC 次数

Gen 0 Size (gen-0-size)

0 代 GC 的字节数

Gen 1 GC Count (gen-1-gc-count)

每秒1 代 GC 次数

Gen 1 Size (gen-1-size)

 GC 的字节数

Gen 2 GC Count (gen-2-gc-count)

每秒2 代 GC 次数

Gen 2 Size (gen-2-size)

2 代 GC 的字节数

LOH Size (loh-size)

大型对象堆的字节数

POH Size (poh-size)

固定对象堆的字节数

GC Fragmentation (gc-fragmentation)

GC 堆碎片率

Monitor Lock Contention Count (monitor-lock-contention-count)

每秒锁竞争计数

Number of Active Timers (active-timer-count)

活动计数器

Number of Assemblies Loaded (assembly-count)

程序集加载数量

ThreadPool Completed Work Item Count (threadpool-completed-items-count)

 每秒ThreadPool 完成任务数

ThreadPool Queue Length (threadpool-queue-length)

当前ThreadPool中的任务数

ThreadPool Thread Count (threadpool-thread-count)

当前ThreadPool 中的线程数

Working Set (working-set)

当前进程使用内存(MB)

IL Bytes Jitted (il-bytes-jitted)

JIT 编译的 IL 的总节数(>=.net5)

Method Jitted Count (method-jitted-count)

JIT 编译的方法总数(在实践中没查看到这个指标)(>=.net5)

GC Committed Bytes (gc-committed-bytes)

GC 的数据量(MB)(>=.net6)

(注意:以上是按自己的理解进行的翻译,有不准确的地方请指正)

给TA打赏
共{{data.count}}人
人已打赏
.NET

.NET 中的counter(一)

2022-7-20 10:18:06

.NET

记一次 .NET 某新能源系统 线程疯涨 分析

2022-7-22 9:42:56

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
有新私信 私信列表
搜索