2024-03-19
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 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 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
types for Java 8

By the way, OptaPlanner is a great to solve resource planning issues and perform some exploration tests.

However, I would recommend to not follow the flags they wrote since many of them are already deprecated. However this publicaton form 2017 is worth to read (from Josef Pavelec).

A cool Log analyzer :

I have discovered this Saas service to analyse your GC logs and suggest you some useful GC / 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
GC Log Analyzer : report

 

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

 

GC Log Analyzer : report
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 : Heap usage
GC Log Analyzer : GC Stats
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 →