There are many GC log tools , the one we’ll talk about today is Garbagecat, which is opensource btw. I plan to do a post about GCViwer.
This tool is for users to parse and analyze GC log files of jvm. More technically is a command line tool, for either JVM tuning and troubleshooting for JDK’s: OpenJDK and Sun/Oracle JDK. It’s similar to a *log* analyzer like BabelTrace, but it’s actually on the terminal. There is a wiki here .
To get all the data for the tool to work is necessary to use the following flags:
-XX:+PrintGC -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps
This tool will parse the gc log and it will produce a file with several sections, which are explained below:
Bottlenecks Events this section will say the throughput. Throughput = (Time spent not doing GC) / (Total Time). Throughput of 100 means no time spent doing GC (good), therefore the closer to 100 the better since it means less time doing GC.
JVM they present the summary of the system, with swap info, JVM, and the command line – the ones you selected and the default ones.
Summary it will give more information on the GC events, with the event types. The GC throughput will be shown too. The timestamps will be given in milliseconds (divide by 3600000 to have the hours).
Analysis in this part categorized in warns | errors | info will be given. The analysis is done on the flags that are present and the ones are actually not present on the command line and how this could be done.
-The -XX:+PrintHeapAtGC option is enabled. The additional data output with this option is not being used for analysis, so it is extra logging overhead. If there is not a good use case for enabling this option, remove it.
[Unidentified Events] the events that occur and could not be identified by the tool. This section only appears if unidentified events occur.
garbagecat -r -p -t 50 -o [report.txt] [log file]
garbagecat: is actually the java -jar [jar]
-r : reorder: in case the timestamps are not in order
-p : parse:
-t : threashold, i.e. <show me any log line that the thoughput was less then x%>
-o : output file: write a file name
I will soon create an entire post about the GC tunning as I go deep on the details, but I also see this reference too , which is from Plumbr, and I’ll keep referencing this source. But basically, when tuning the JVM one can focus on one of the three aspects: latency, throughput, and footprint (there are other aspects explained on The Garbage Collection Handbook, like completeness, but won’t talk about it this time).
After seeing the aspect one wants to improve, the next step is to search a GC algorithm that matches it and then improve from that aspect, for example the CMS that can be fined tuned with Ratio, and NewSpace (and MaxNewSpace) or the G1GC that can be tuned by the size of the regions (to avoid humongous regions). ZGC/Shenandoah can be improved in several aspects (one of the is the pacing and the heuristics).
The analysis part of this tool is powerful but give many suggestions on the GC flags.
JBOSS in Eclipse
Well, I use JBOSS diretly on Eclipse, where I develop my servlets, and I change the settings my VM options using the VM arguments in Edit Configuration opening the launch configuration, in Overview. Follow this link.
OR it’s possible to change the standalone.conf diretly But it’s up to you what to change actually.
Analyzing the code, we can see that it’s organized similarly to another software I worked with – TraceCompass, in the sense of several classes implementing events that extend one main one – with name, id, and timestamp. And because it’s java, which both are. Though Gargabagecat is much smaller than TraceCompass.
Link to change the Jboss VM arguments in Eclipse