Tuesday, 31 March 2015

How to Tune Java Garbage Collection

How to Tune Java Garbage Collection

This is an excelent and very clear article on Java JVM tuning.

Think about the fundamental cause of GC tuning. The Garbage Collector clears an object created in Java. The number of objects necessary to be cleared by the garbage collector as well as the number of GCs to be executed depend on the number of objects which have been created. Therefore, to control the GC performed by your system, you should, first, decrease the number of objects created.
 The following table shows options related to memory size among the GC options that can affect performance.
Table 1: JVM Options to Be Checked for GC Tuning.
ClassificationOptionDescription
Heap area size-XmsHeap area size when starting JVM
-XmxMaximum heap area size
New area size-XX:NewRatioRatio of New area and Old area
-XX:NewSizeNew area size
-XX:SurvivorRatioRatio of Eden area and Survivor area
I frequently use -Xms-Xmx, and -XX:NewRatio options for GC tuning.  -Xms and -Xmx option are particularly required. How you set the NewRatio option makes a significant difference on GC performance.Some people ask how to set the Perm area size? You can set the Perm area size with the-XX:PermSize and -XX:MaxPermSize options but only when OutOfMemoryError occurs and the cause is the Perm area size.


The full article can be founs at : http://www.cubrid.org/blog/dev-platform/how-to-tune-java-garbage-collection/

No comments:

Post a Comment