Tuesday, May 17, 2011

JVM Issues !!!

Resource for JVM Troubel shooting: 
  • Log files messages -  -verbose:gc, –XX:+PrintGC, –XX:+PrintGCDetails,–XX:+PrintGCTimeStamps, -XX:+HeapDumpOnOutOfMemoryError
  • Java VisualVM - Available from JDK 6. Federates several existing tools, including JConsole, jstat, jinfo, jstack, and jmap
  • Other Tools - Jprobe, Jconsole, HPROF - Heap Profiler, Eclipse Memory Analyzer, IBM Heap & thread analyzer
  • JVM Utilities - Jps, Jmap, Jinfo, Jhat, Jstack
  • Unix Tools - Top, vmstat, ulimit –a , sar –r , mpstat, netstat
Typical JVM - 6 Parameters

  -Xms1024m \ - Minimum Heap   -Xmx1024m \ - Maximum Heap
  -Xss512k \ - Set maximum native stack size for any thread
  -XX:+UseConcMarkSweepGC
  -XX:GCTimeRatio=99 \ - The ratio of GC time to application time
  -XX:MaxGCPauseMillis=20 \ - Pause times of 20ms desired.
 -XX:PermSize=512m \ - Permanent Size 
 -XX:MaxPermSize=512m \  
 -XX:NewSize=384m \ - Minor GC (Young Generation) -XX:MaxNewSize=384m \
  -XX:SurvivorRatio=6 \

JVM Collectors - Options

1. Mark and sweep
Minimizes pause times, avoid "stopping the world“
Collect the tenured generation concurrently with the execution of the application
Start VM - mark each object – Remove
-XX:+UseConcMarkSweepGC

2. Throughput collector Parallel Collector
Distributes GC load across CPUs. Maximize throughput
XX:+UseParallelGC
Can be used for Multiprocessor Machines  (with four or more processors)