Thursday, November 7, 2013

Java Commands

Java Tuning

jstat -gcutil -t <Process_id> 1000
         To know the status of  GC. 
jmap -heap <Proces ID of your JVM>         Heap Size
jmap -histo:live 18281 | head
          classes used for

Java Command running
java -cp lib/WEB-INF/lib/*:/home/wcuser/stubs/lib/WEB-INF/classes:. wavecrest.stubs.BillDeskStubServer &


Kill -3 pid to take thread dump u can redirect it to a file.


export JAVA_OPTS="-Xms1536m -Xmx4096m -XX:MaxPermSize=256m -Xmn1024m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+HeapDumpOnOutOfMemoryError -XX:+AggressiveOpts -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=10.10.18.200 -Dsun.rmi.dgc.server.gcInterval=120000 -Xloggc:./gclog -verbose:gc -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=100"


It is possible to instruct the JVM to create automatically a heap dump in case that it runs out of memory, i.e. in case of a OutOfMemoryError error. To instruct the JVM to create a heap dump in such a situation, start your Java application with the -XX:+HeapDumpOnOutOfMemoryError option.

No comments:

Post a Comment