How do you decide to GC or not to GC?
To measure GC, we use a measure called JVM throughput. JVM throughput measures the percentage of time it did not spent on GC (in other words, time it spending doing useful work). If JVM throughput is greater than 90%, you should NOT be tuning GC. If it is less, then may be you should.
OK, then how do you measure JVM throughput?
- Run you program with following GC parameters.This will write the GC logs to gc.log file of the home directory
- To analyse, download and unzip GC Viewer from https://github.com/chewiebug/GCViewer/releases
Start the GC viewer by running following command from the unzipped directory.
$java -jar gcviewer-1.32.jar
- Then open the gc.log file and it shows the throughput.
-Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
Also you can use IBM pattern modelling tool from alpha works.