java GC optimization, G1GC

本文介绍了Java JVM内存配置参数及优化方法,包括年轻代、老年代的大小设置,垃圾回收器的选择,以及如何减少垃圾回收暂停时间。通过具体案例展示了优化前后的JAVA_OPTS配置对比。

引用    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"

转载于:https://www.cnblogs.com/lpthread/p/3410081.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值