FAQs - mgm3746/garbagecat GitHub Wiki

Why is application stopped time output (-XX:+PrintGCApplicationStoppedTime) a standard recommended option?

This option used to only include garbage collection time, was not accurate, and garbagecat ignored it. However, beginning in JDK7/8, it started including stopped time for the other JVM operations performed at safepoint (e.g. ThreadDump, HeapDumper, GetAllStackTrace, PrintThreads, PrintJNI, RevokeBias, Deoptimization, FindDeadlock). Therefore, it is now a required logging option to determine overall throughput and identify pause and throughput issues not related to garbage collection.

Why does it take garbagecat a long time to run with large files?

garbagecat is designed to parse gc logging using standard recommended production options with file rotation. There should not be a use case for parsing gc logging that is on the order of hundreds of MBs or larger in size.

If you find you are analyzing huge gc log files (>25 mb), consider if log file rotation needs to be implemented, or the logging includes extraneous information.

gc logging should be rotated/archived to protect disk space, the same as any other logging. It is not necessary to analyze huge periods of time to identify a gc issue, and it can needlessly complicate analysis.

If you have a huge log file covering a long period of time, you can split the file to speed up analysis. For example, to split a file into ~25 mb sizes:

split -d -C 25000000 gc.log gc.log.

Then parse only the relevant data:

java -jar garbagecat.jar gc.log.12

If the gc log file is huge due to extraneous information, consider moving to standard logging options that do not include heavyweight logging events not suitable for production and/or do not contribute to gc analysis. Any logging event that implements ThrowAwayEvent is not used by garbagecat.

For example, the following in vim will remove ClassHistogram logging:

:g/^   \d:.*$/d
:g/^  \d\d:.*$/d
:g/^ \d\d\d:.*$/d
:g/^\d\d\d\d:.*$/d
:g/^\d\d\d\d\d:.*$/d
:g/^ num.*/d
:g/^Total.*/d

The following in vim will remove Tenuring Distribution logging:

:g/^-.*$/d
:g/^Desired.*$/d

It is best to implement logging options and file rotation so none of this is necessary, as there is always some risk that manually editing files could introduce issues.

What causes Invalid file: '/home/garbagecat/files/gc.log' when running as a container?

When you run as a container, it completes without issue:

$ docker run --pull=always -v "$PWD":/home/garbagecat/files:z ghcr.io/mgm3746/garbagecat:main -t 20 -p -c /home/garbagecat/files/gc.log > gc.log.cat

However, there is the following in the output:

$ cat gc.log.cat
Invalid file: '/home/garbagecat/files/gc.log'
usage: garbagecat [OPTION]... [FILE]
 -c,--console               print report to stdout instead of file
 -h,--help                  help
 -j,--jvmoptions <arg>      JVM options used during JVM run
 -l,--latest                latest version
 -o,--output <arg>          output file name (default report.txt)
 -p,--preprocess            do preprocessing
 -r,--reorder               reorder logging by timestamp
 -s,--startdatetime <arg>   JVM start datetime (yyyy-MM-dd HH:mm:ss.SSS)
                            to convert uptime to datestamp
 -t,--threshold <arg>       threshold (0-100) for throughput bottleneck
                            reporting
 -v,--version               version

This can be caused by a file format or permission issue preventing the container from reading the gc.log file.

Execute the following in the directory where gc.log exists:

$  cp gc.log gc.log.bak
$  mv gc.log gc.log.old
$  mv gc.log.bak gc.log

$ chmod a+rwx *
⚠️ **GitHub.com Fallback** ⚠️