[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.

environment

download

Click the link for the latest version of "download | download mac version" on the following page to download. https://github.com/chewiebug/GCViewer/wiki/Changelog

In the case of Windows, the jar file will be downloaded, so place it in any folder.

Start-up

  1. Double-click the gcviewer jar
    021.PNG
    → The following screen is displayed 002.png
  2. Drag and drop the GC log text file in the window
    → The following screen will appear 020.png

Change the display

  1. Check off Menu> View> Data Panel
    → The data panel on the right disappears and becomes wider 004.png
  2. 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) 005.png
  3. 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. 006.png
  4. 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 007.png
  5. 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. 008.png
  6. 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) 009.png
  7. 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. 010.png
  8. Check on Full GC Lines
    → Full GC becomes visible as a black line 011.png

Check viewpoint

  1. Is the young generation heap usage down to the bottom after Young GC?
  2. 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?

Recommended Posts

How to use GC Viewer
How to use Map
How to use rbenv
How to use letter_opener_web
How to use fields_for
How to use java.util.logging
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
[Java] How to use Map
How to use Chain API
[Java] How to use Map
How to use Priority Queuing
[Rails] How to use enum
How to use JUnit (beginner)
How to use Ruby return
[Rails] How to use enum
How to use @Builder (Lombok)
[Swift] How to use UserDefaults
How to use java class
How to use Swift UIScrollView
How to use Big Decimal
[Java] How to use Optional ②
[Java] How to use removeAll ()
How to use String [] args
How to use rails join
How to use Java Map
Ruby: How to use cookies
How to use dependent :: destroy
How to use Apache POI
[Rails] How to use validation
How to use Java variables
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
[Java] How to use Optional ①
How to use Lombok now
[Creating] How to use JUnit
[Rails] How to use Scope
Java memory management and how to read GC Viewer
[Rails] How to use gem "devise"
How to use Lombok in Spring
How to use StringBurrer and Arrays.toString.
How to use arrays (personal memorandum)
How to use Java HttpClient (Get)
How to use scope (JSP & Servlet)
[Rails] How to use devise (Note)
How to use the form_with method