简体   繁体   English

G1GC 日志中的时间

[英]Times in G1GC logs

I've read a few descriptions of different times printed in G1GC logs but couldn't really prove/understand when I produced them locally.我已经阅读了 G1GC 日志中打印的一些不同时间的描述,但是当我在本地生成它们时无法真正证明/理解。 For example, following log was produced on my PC with Java 11. I wanted to know, what's the difference between 0.500ms in the first line vs 0.01s in the second?例如,以下日志是在我的 PC 上使用 Java 11 生成的。我想知道,第一行中的 0.500 毫秒与第二行中的 0.01 秒之间有什么区别? Was the application paused (because of STW) for 0.500ms or for 10ms (0.01s)?应用程序暂停(因为 STW) 0.500 毫秒还是 10 毫秒(0.01 秒)? I tried tools like GCeasy, it shows max pause time of 10ms, and in cases where Real = 0.00, GCeasy shows min pause of 0ms.我尝试过像 GCeasy 这样的工具,它显示最大暂停时间为 10 毫秒,在 Real = 0.00 的情况下,GCeasy 显示最小暂停时间为 0 毫秒。 I wonder, what kind of pause is 0.500ms representing then?我想知道,0.500ms 代表什么样的暂停呢?

[9.090s][info][gc ] GC(25) Pause Young (Normal) (G1 Evacuation Pause) 77M->2M(128M) 0.500ms [9.090s][info][gc] GC(25) Pause Young (Normal) (G1 Evacuation Pause) 77M->2M(128M) 0.500ms

[9.090s][info][gc,cpu ] GC(25) User=0.00s Sys=0.00s Real=0.01s [9.090s][info][gc,cpu] GC(25) User=0.00s Sys=0.00s Real=0.01s

Edit: GC Pause time difference in gc.logs vs in JMC编辑:gc.logs 与 JMC 中的 GC 暂停时间差异

0.687ms pause in gc.log在 gc.log 中暂停 0.687 毫秒在此处输入图片说明

Where as 1.331 second according to JMC根据江铃汽车的数据为 1.331 秒在此处输入图片说明

I am not sure if I should post this as an answer, because this is my understanding of this log, but it would be too big for a comment it seems.我不确定我是否应该将其作为答案发布,因为这是对此日志的理解,但似乎对于评论来说太大了。

The total time of the STW event was 0.500ms if you look with the eyes of G1GC and was neither 0.500ms nor 10ms if you take Shenandoah for example.在总时间STW事件为0.500ms ,如果你看一下用眼睛G1GC和既不0.500ms ,也不10ms ,如果你把Shenandoah的例子。 When you use G1GC , STW event is treated as 0.500ms , using Shenandoah , will result in 0.500ms + delta ;当你使用G1GCSTW event被视为0.500ms ,使用Shenandoah ,将导致0.500ms + delta where this delta will be the cumulative time it took to bring all java threads to a safepoint (also called TTSP - time to safe point) + whatever clean-up was needed for that safepoint .其中,该delta将是累计花费的时间将所有java threadssafepoint (也称为TTSP -时间到安全点)+什么是需要的是清理safepoint May be a picture will make this easier:可能是一张图片会让这更容易:

   |------|------------------------|---------| 
   | TTPS |   G1 Evacuation Pause  | CleanUp |
   |------|------------------------|---------|

G1GC treats as the STW Event the G1 Evacuation Pause region only . G1GC对待作为STW EventG1 Evacuation Pause唯一地区。 Shenandoah for example, treats the entire thing as the STW event (all 3 regions).例如, Shenandoah将整个事件视为STW事件(所有 3 个区域)。 Who is right?谁是对的? I will leave this up to you to decide.我会把这留给你来决定。

You can enable the safepoint granularity for G1GC via -Xlog:safepoint* , for example.例如,您可以通过-Xlog:safepoint*G1GC启用安全点粒度。

The tools that you are using have their own "opinion" oh how to treat each time produced by the logs, I guess;您使用的工具有自己的“意见”哦,我猜如何处理日志产生的每次; but it is absolutely not 10 ms .但绝对不是10 ms Why?为什么? As you have seen already (as you say in comments) there are times when you will get something like this in logs:正如您已经看到的(正如您在评论中所说),有时您会在日志中得到类似的信息:

[9.090s][info][gc ] GC(25) Pause Young (Normal) (G1 Evacuation Pause) 77M->2M(128M) 0.500ms

[9.090s][info][gc,cpu ] GC(25) User=0.00s Sys=0.00s Real=**0.00s**

Notice the Real=0.00s .注意Real=0.00s Does this mean there was no pause ?这是否意味着没有停顿 Of course not, it just means there was no cpu time spent.当然不是,这只是意味着没有花费 cpu 时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM