java GC optimization, G1GC

引用    http://www.avricot.com/blog/?post/2010/05/03/Get-started-with-java-JVM-memory-(heap%2C-stack%2C-xss-xms-xmx-xmn...)

 

  -Xmx : max heap size (ex: -Xmx4g)

  -Xms : min heap size. (ex: -Xms2g) 

  -Xmn : the size of the heap for the young generation
      Young generation represents all the objects which have a short life of time. Young generation objects are in a specific location into the heap, where the garbage collector will pass often.

      All new objects are created into the young generation region (called "eden").

      When an object survive is still "alive" after more than 2-3 gc cleaning, then it will be swap has an "old generation" : they are "survivor" .
      Good size is 33%

优化之前

  JAVA_OPTS="-Xmn3g -Xms4g -Xmx4g -XX:PermSize=512m -XX:MaxPermSize=512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"

优化之后

  JAVA_OPTS="             -Xms4g -Xmx4g -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+ParallelRefProcEnabled -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"

posted on 2013-11-06 11:12  lpthread  阅读(525)  评论(0编辑  收藏  举报