How to tune your JVM memory and track your GC Usage ? I had to tune recently some docker containers to fit the memory of my EC2. Here is a list of interesting resources that helped me.
A list of interesting resources about GC and JVM Tuning :
Which GC algorithm is the best ?
This link is quite helpful : https://www.optaplanner.org/blog/2015/07/31/WhatIsTheFastestGarbageCollectorInJava8.html
Basically, one of my biggest surprise, they are not recommending G1 algorithm, much slower.
By the way, OptaPlanner is a great tool to solve resource planning issues and perform some exploration tests.
However, I would recommend to not follow the JVM flags they wrote since many of them are already deprecated. However this publicaton form 2017 is worth to read (from Josef Pavelec).
A cool Garbage Collector Log analyzer :
I have discovered this Saas service to analyse your GC logs and suggest you some useful GC / JVM Flags : https://gceasy.io/.
Here are some screenshots extracted from a report, I produced with a JEE applications using too much memory and producing a lot of GC.
The report is quite beautiful and provides interesting indicators. Here ,the program is requesting more memory from the JVM than available.
Reading your log file, it may produce memory graph as below. To obtain this result you have to provide some parameters to your JVM :
-Xmx1000m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseGCOverheadLimit - -Xloggc:gcvideopublisher.log
I hope these two information are useful for your Java developments. You may find some other hints and tricks in these links :