Java garbage collection: small, large, full

I am trying to find garbage collection in a large enterprise Java application. I have GC logs and started to study them using various tools - the screenshot here is taken using GCViewer . (Unfortunately, there are no magazines with more detailed GC information ...)

I also read in the Java Hotspot VM garbage collection that we use.

But I'm still somewhat confused: the following is a screenshot of an enlarged section of the GC graph.

Zoom on garbage collection graph

There are three things:

  • There is a “little zigzag” of the blue line (which you can hardly see): from what I understand, these are the minor gc cycles that occur in Jung's space.
  • There is a black bar that is blocking 10 with full GC, as can be seen from the logs:

    1751585.394: [Full GC 1433326K->660045K(1552832K), 10.1157600 secs] 
  • Then the “big zigzag” of the blue line appears (appears in the fall on the left). It bothers me.

The logs for template # 3 do not mark it as a full GC, but look similar to the rest ...

  1749795.648: [GC 1299871K(1552832K), 0.0402933 secs] 
  • So is this also a small GC?
  • If so, why are there two different patterns of small garbage collections occurring simultaneously (# 1 and # 3)?
  • Or is there something else between the small GC in Young space and the full GC in Tenured?

Change Additional Information:
GC Used: Concurrent Mark-Sweep GC
Throughput is 93.8%
Longest pause: 10.116 seconds
Time paused: 6.21%

+5
source share
3 answers

The garbage collector for generating Java has several different “types” of garbage collection. As you already mentioned, “small zigzags” are small collections in a young space, and a black bar is a complete collection of garbage. For the sake of simplicity, I will simply describe the most important parts of what is happening.

The younger generation is divided into the Eden space by one or more “surviving” spaces. During one of these small zigzags, dead objects in Eden's space are removed, and living objects are moved to one of the survivors. This is a very fast operation, because the weak generation hypothesis states that most objects will be short-lived. A subsequent scan of the surviving space can move objects that are still alive from the space of the survivors into a generation of generations. It is still considered a small collection.

I suspect that what you see in the first big fall is actually a “progression” from surviving generations to generation after generation.

A supported generation is all that is not young enough to be in the young generation (which means, like many other GC options, it’s configurable). The labor generation is much larger than the younger generation, and therefore takes a long time to sweep. When you talk about “complete” garbage collection, this refers to the scope of the generation (in addition to the younger generation).

The CMS garbage collector works at the same time for most of the things that it does, but still has to stop the world for labeling operations on the young and the generation of generations. The CMS builder is supposed to be very fast, even for large heaps. However, there is another situation where the CMS stops the world: parallel mode failure .

The second big drop with a pause may have been the result of this, which occurs when a generation of generations is too full. You can adjust the size of the generator and other parameters to avoid this.

+2
source

I doubt this is a parallel scan. To confirm, you need to track the following

 -verbose:gc -XX:+PrintGCDetails 

And assuming the graph shows the younger generation of generations, this cannot be a promotion from generations of survivors to generation, as Jonathan said.

0
source

Based on the magazines you have, I would say:

1) This is a small collection. As @Eugene said above, it is short and not marked as full-gc.

2) in your application there are two types of short-lived objects. Some very short-lived ones that “delay” the time between these two small zigzags. And some are more long-lived, which are still short-lived to be promoted to the generation of generation, and which become suitable for collecting Gabala at some point in front of an intricate secondary collection.

There may be another explanation, but I do not believe that you can say this from what you have.

If this bothers you (or maybe if you are just curious), I would enable more detailed gc logging and use logs like your access logs to try to match application activity to crashes.

0
source

Source: https://habr.com/ru/post/1202071/


All Articles