gpt4 book ai didi

.net - 性能计时器 "% Time in GC"会不会出错?

转载 作者:行者123 更新时间:2023-12-02 01:22:34 25 4
gpt4 key购买 nike

我们发现,从今天开始,“% Time in GC”(垃圾收集器中的百分比时间)性能计时器稳定地保持在 100%,只是偶尔会稍低一些。即使在晚上也没有访客在线。

然后我将App_Offline.htm放在根目录中。通常这会导致所有 ASP.NET 事件停止。但由于某些奇怪的原因,“GC 时间百分比” 虽然降低至 34%,但仍保持稳定。

我在这里寻找的是显而易见的东西吗?其他一些与 GC 相关的性能计数器似乎仍然起作用,但作用不大。

编辑:我写的是“只有今天”,但实际上是“从今天开始”。从那以后它就没有消失过。

最佳答案

Jrista pointed in the right direction与他的回答,但这种行为的实际原因却大不相同:

“% Time in GC”计数器不是实时计数器。相反,它显示上次 GC 发生时测量的最后一个值。当您使用 App_Offline.htm 关闭 Web 应用程序时,GC 将运行并占用一定的百分比。之后,CLR 完全不活动(App_Offline 的目的),因此不会发生进一步的垃圾收集,并且百分比保持不变。因此,即使 ASP.NET CLR 事件为零,也是直线。

这是这个计数器的描述,我复制在这里作为引用(并提醒自己在问愚蠢的问题之前先阅读计数器的解释)。

% Time in GC is the percentage of elapsed time that was spent in performing a garbage collection (GC) since the last GC cycle. This counter is usually an indicator of the work done by the Garbage Collector on behalf of the application to collect and compact memory. This counter is updated only at the end of every GC and the counter value reflects the last observed value; its not an average.

关于.net - 性能计时器 "% Time in GC"会不会出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1829450/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com