获取“大对象堆大小";使用在Linux上运行的.net核心的指标 [英] Get "Large Object Heap Size" metric using .net core running on linux

查看:51
本文介绍了获取“大对象堆大小";使用在Linux上运行的.net核心的指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得在Linux(Ubuntu 18.04)上运行.net core(3.1)的性能计数器大对象堆大小"?

解决方案

什么是LOH:

.NET垃圾收集器(GC)将对象分为小块和大物件.当对象较大(> = 85,000字节)时,被认为是一个大对象,诸如将其复制到内存中的其他操作在堆上-可能很昂贵.正因为如此,.NET垃圾收集器将大对象放在大对象堆(LOH)上.

.NET Core应用程序可探索的几种方法

  1. 对于Windows特定:

    转到性能监视器> AddCounter> .NET CLR内存>大ObjectHeap大小>选择应用程序名称

  2. dotnet计数器:

    dotnet-counters是.NET Core应用程序的性能监视工具

    示例用法:

    dotnet工具安装--global dotnet-counters

    dotnet-counters监视器--process-id 1902 System.Runtime

    其他参考:

    https://docs.microsoft.com/zh-cn/dotnet/api/system.runtime.gcsettings.largeobjectheapcompactionmode?view = netframework-4.8#System_Runtime_GCSettings_LargeObjectHeapCompactionMode

    How do I get the performance counter "Large Object Heap Size" running .net core (3.1) on linux (Ubuntu 18.04)?

    解决方案

    What is LOH:

    The .NET Garbage Collector (GC) divides objects up into small and large objects. When an object is large(>=85,000 bytes), it’s considered a large object, actions like copying it in memory elsewhere on the heap -- can be expensive.Because of this, the .NET Garbage Collector places large objects on the large object heap (LOH).

    Few approaches that can be explored for .NET Core Apps

    1. For Windows Specific:

      Go to Performance Monitor > AddCounter > .NET CLR Memory > Large ObjectHeap Size > Select App Name

    2. dotnet-counters:

      dotnet-counters is a performance monitoring tool for .NET Core apps

      Example Usage:

      dotnet tool install --global dotnet-counters

      dotnet-counters monitor --process-id 1902 System.Runtime

      https://github.com/dotnet/diagnostics/blob/master/documentation/dotnet-counters-instructions.md

    3. dotnet-dump:

      The dotnet-dump CLI global tool is way to collect and analyze Windows and Linux dumps all without any native debugger involved like lldb on Linux

      $ dotnet tool install -g dotnet-dump

      $ dotnet-dump collect --process-id 1902

      $ dotnet-dump analyze ./core_20190226_135850

      https://github.com/dotnet/diagnostics/blob/master/documentation/dotnet-dump-instructions.md

    4. dotnet-trace:

      The dotnet-trace tool is a cross-platform CLI global tool that enables the collection of .NET Core traces of a running process without any native profiler involved

      $ dotnet tool install --global dotnet-trace

      dotnet-trace collect --process-id <PID> --providers Microsoft-Windows-DotNETRuntime

      https://github.com/dotnet/diagnostics/blob/master/documentation/dotnet-trace-instructions.md


    How do I get the performance counter "Large Object Heap Size" running .net core (3.1) on linux

    Other Reference:

    https://docs.microsoft.com/en-us/dotnet/api/system.runtime.gcsettings.largeobjectheapcompactionmode?view=netframework-4.8#System_Runtime_GCSettings_LargeObjectHeapCompactionMode

    这篇关于获取“大对象堆大小";使用在Linux上运行的.net核心的指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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