Saturday, 28 April 2012

Java Visual VM & Visual GC

I’ve always found hard to memorize java GC parameters. Java GC tuning has become a major issue after systems with huge memory and multiple cpu’s has emerged. I believe that Java GC management sounds like an unknown grey area for most developers, This conception has grown due to increasing configuration options. Although there is java performance portal and complete dedicated page for GC tuning, it’s still not easy to visualize dozens of GC terms instantly.

For those finding GC terms difficult and want see what actually these terms (perm/young/old generations, survivor spaces, etc ) means, there is a visual gc plugin which can be installed to visual vm shipping with jdk 1.6. Basically Visual VM looks like an improved version of jconsole tool with an add-in architecture.

Below I uploaded a visual gc picture of a java app running locally. Thanks to visual gc plugin, it’s quite easy to monitor and visualize memory consumption of java applications.

java visual gc
Java Visual GC

After seeing the picture, it’s time to revisit some GC parameters as;

--XX: NewRatio        –> Old / (Eden + S0 +S1)
--XX: SurvivorRatio  –> Eden / S0
--XX: MaxPermSize  –> Perm

where S0 equals S1 and they are called From and To survivor spaces, while Eden + S0 + S1 altogether define young generation size.

Recalling that a java app's min and max memory sizes are defined by -Xms and -Xmx, Jvm will split an app's memory into Perm, Old, Eden, S0,S1 regions according to ratios above.

No comments:

Post a Comment