Most Popular Posts

27/08/2013

Garbage Collectors - IBM JVM

TL;DR

-Xgcpolicy:gencon (default in V8)-Xgcpolicy:optthruput (previously default)
-Xgcpolicy:optavgpause
-Xgcpolicy:balanced




Details:

Garbage collector in IBM JVM, just as other GCs collects unused, dead, objects from the heap in order to recover some memory so it is able to allocate new objects on the heap. IBM JVM provides several GC algorithms:
  • -Xgcpolicy:gencon
    • Unused objects are removed, and the survivors are allocated in survivor spaces. After some time it is promoted to the Tenure space.

  • -Xgcpolicy:optthruput (previously default)
    • This algorithm works as MSC (Mark-Sweep-Compact). This means in the first run collector marks live objects, in the second run sweeps unused objects, and compacts the free space. This is being done in parallel. MSC process differs between different JVMs.

  • -Xgcpolicy:optavgpause
    • This policy can be used when the application can't tolerate long pauses in exchange for overall throughput. System tries to determine when next GC would be needed and then runs concurrent GC. before allocating new objects, some GC would be done.

  • -Xgcpolicy:balanced
    • This is a new in V8 collector policy. different regions of a heap map are dealt individually. More information soon




Read more on:

http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.60%2Fdiag%2Fappendixes%2Fcmdline%2Fcommands_gc.html

Garbage Collection Options and Functions


Garbage collection options:

In addition to one of the previous posts regarding memory management options in various JVMs, now it is time to present some options for the GC (Garbage Collector)

Select specific collector:
  • -XX:+UseSerialGC
  • -XX:+UseParallelGC
  • -XX:+UseParallelOldGC (combine with -XX:+UseParallelGC)
  • -XX:+UseConcMarkSweepGC
  • -Xnoclassgc is to disable garbage collection for permanent generation

Tune the Parallel GC:

  • -XX:ParallelGCThreads=n - limit parallel threads by 'n'
  • -XX:MaxGCPauseMilis=n - limit pause in miliseconds
  • -XX:GCTimeRatio=n - throughput (percentage of CPU time spent on application
Increase debug level:

  • -XX:+PrintGC - get basic information
  • -XX:+PrintGCDetails - get verbose information
  • -XX:+PrintGCTimeStamps - add timestamps
  • -XX:+HeapDumpOnOutOfMemoryError very useful :)