[JAVA] How to use GC Viewer
I used GC Viewer to check the GC log of the JVM after a long time, so I will leave a note.
- OS: Windows 8.1
- Java: java version "1.8.0_231"
- Gcviewer: gcviewer-1.36-SNAPSHOT.jar
Click the link for the latest version of "download | download mac version" on the following page to download.
In the case of Windows, the jar file will be downloaded, so place it in any folder.
- Double-click the gcviewer jar
→ The following screen is displayed
- Drag and drop the GC log text file in the window
→ The following screen will appear
Change the display
- Check off Menu> View> Data Panel
→ The data panel on the right disappears and becomes wider
- Right-click around the time column> Check Log start time
→ The time column is displayed as the time (when the GC log contains a time stamp)
- Check on Total Heap
→ The total heap size is displayed in red
Here, -Xms (start size) and -Xmx (maximum size) are set to the same value, so the total heap size is in a straight line.
- Turn off Total Heap and check on Tenured Generation, Young Generation
→ The size of the Young generation is displayed in yellow, and the size of the Tenured generation (Old generation) is displayed in purple.
Usually Young Generation + Tenured Generation = Total Heap
- Check on Used Tenured Heap, Used young Heap
→ The heap usage in each generation can be seen as a line. The vertical line indicates that the memory has been released by the GC.
- Adjust the ratio in the select box at the top so that the start / end of the GC log fits in the entire window (★ important).
If you don't do this, you may think that there is no problem with checking only a part of the range. This time, I adjusted the ratio at this timing, but it is better to start the survey as soon as possible so that the whole can be seen.
What you can see from the graph
--Young GC is occurring quite often. Yong GC almost frees the Young generation (gray line falls below the yellow area)
--The Tenured generation Full GC has occurred twice. Both have fallen almost to the bottom, so they have been released. After that, I am worried that the memory of the Tenured area is increasing. Probably Full GC will occur again after this, but if it is released to the bottom at that time, there is no problem (no confidence)
- Check on Used Heap
→ Until now, the Young generation and Tenured generation were displayed separately, but now the total (= heap usage) of the Young generation and Tenured generation can be seen in blue.
- Check on Full GC Lines
→ Full GC becomes visible as a black line
- Is the young generation heap usage down to the bottom after Young GC?
- Has the heap usage of the Tenured generation dropped to the bottom after Full GC?
Actually, I don't really know how to evaluate GC logs.
In this graph, the number of tenured generations is increasing, but should it be released to the bottom in the next Full GC?