2021-11-17
GC Log Analyzer : Heap usage

How to tune your JVM memory and track your GC Usage ?

https://sylvainleroy.com/wp-admin/options-general.php?page=ad-inserter.php#tab-2

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.

Garbage collector types for Java 8

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.

 

GC Log Analyzer : report

 

The report is quite beautiful and provides interesting indicators. Here ,the program is requesting more memory from the JVM than available.

 

GC Log Analyzer : KPI

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

GC Log Analyzer : Heap usage
GC Log Analyzer : GC Stats

 

I hope these two information are useful for your Java developments. You may find some other hints and tricks in these links :

 

 

 

Sylvain Leroy

Senior Software Quality Manager and Solution Architect in Switzerland, I have previously created my own company, Tocea, in Software Quality Assurance. Now I am offering my knowledge and services in a small IT Consulting company : Byoskill and a website www.byoskill.com Currently living in Lausanne (CH)

View all posts by Sylvain Leroy →
Exit mobile version