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

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

GC Log Analyzer : Heap usage

Share on LinkedIn
Pocket

How to tune your memory and track your GC Usage ? I had to tune recently some 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
Garbage collector types for 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 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
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 : 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 :

 

 

 

Share on LinkedIn
Pocket

, , , , , , , , , ,

About Author

about author

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 knowledges and services in a small IT Consulting company : Byoskill and a website www.byoskill.com

Currently living in Lausanne (CH)

Optimization WordPress Plugins & Solutions by W3 EDGE