Times in G1GC logs

孤人 提交于 2020-06-23 11:39:48

问题


I've read a few descriptions of different times printed in G1GC logs but couldn't really prove/understand when I produced them locally. 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? Was the application paused (because of STW) for 0.500ms or for 10ms (0.01s)? 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. I wonder, what kind of pause is 0.500ms representing then?

[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

Edit: GC Pause time difference in gc.logs vs in JMC

0.687ms pause in gc.log

Where as 1.331 second according to JMC


回答1:


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. When you use G1GC, STW event is treated as 0.500ms, using Shenandoah, will result in 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. 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. Shenandoah for example, treats the entire thing as the STW event (all 3 regions). 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.

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. 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. Does this mean there was no pause? Of course not, it just means there was no cpu time spent.



来源:https://stackoverflow.com/questions/59832510/times-in-g1gc-logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!