您的位置:首页 > 编程语言 > Java开发

java GC optimization, G1GC

2013-11-06 11:12 337 查看
引用 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"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: