Giter Site home page Giter Site logo

Comments (7)

wattsun110 avatar wattsun110 commented on May 14, 2024

谢谢这位同学的关注。

  1. TencentKona-11暂时还没有这个功能,后续会考虑加上去。
  2. 目前在开源的tencentKona-8里面已经针对ps,cms和g1实现了这个功能,但是默认关闭,需要加参数开启,使用方法和参数说明如下:

2.1 在启动参数里添加-XX:+FreeHeapPhysicalMemory,针对PS,CMS和G1算法,则在触发FullGC(G1算法除了FullGC,还包括concurrent cycle)后,JVM会释放没有对象的old区的后半部分虚拟地址空间对应的物理内存(G1算法则会有选择的释放部分没有任何对象的region对应的物理内存)。这个参数开启的情况下,还可以分别配合以下两个参数来实现根据load(2.2所描述)和定时强制触发(2.3所描述)FullGC的功能来实现物理内存回收。

2.2 在FreeHeapPhysicalMemory开启的情况下,如果在启动参数里面指定 -XX:PeriodicGCInterval=x(单位是ms)的话,则JVM会每隔5min,自动判断当前进程的load,如果连续3次低于该进程load的P99的话,则会自动触发一次FullGC进行物理内存回收,PeriodicGCInterval时间间隔内最多只会触发一次FullGC,默认PeriodicGCInterval=0,表示这个功能默认是关闭的,此外,load的衡量方式是ygc的频率,也就是说ygc的频率足够低的话,而且距离上一次Ful GC的时间间隔超过PeriodicGCInterval的话,jvm会自动触发Full GC来回收物理内存。

2.3 在FreeHeapPhysicalMemory参数开启的情况下,kona jdk8里面还添加了一个定时触发FullGC的功能,如果设置ForcePeriodicGCInterval=x(单位为ms),那么每隔x ms,就会触发一次FullGC。

综上所述,如果只是需要FullGC后回收物理内存功能,那么在进程的启动参数添加-XX:+FreeHeapPhysicalMemory即可,如果需要在系统load的低的时候自动触发FullGC回收物理内存,那么需要再配置下PeriodicGCInterval。定期触发FullGC来回收物理内存回收,这个是针对大数据离线任务设计的功能,游戏场景不一定适合,建议不要配置,直接默认关闭即可。

from tencentkona-11.

jiangguilong2000 avatar jiangguilong2000 commented on May 14, 2024

不错,支持做的更加彻底,自己FULLGC的定时脚本都免了

from tencentkona-11.

tcmot avatar tcmot commented on May 14, 2024

其实不能理解为什么这样一个功能,openjdk却不考虑呢?
不知道是出于什么样的考虑,才会忽略这样一个功能.

既然能申请堆外内存,就不让释放.

是不是openjdk最开始没有想过开放堆外内存的功能呢?

毕竟这个功能使用很复杂.

unsafe.

from tencentkona-11.

tcmot avatar tcmot commented on May 14, 2024

其实不能理解为什么这样一个功能,openjdk却不考虑呢?
不知道是出于什么样的考虑,才会忽略这样一个功能.

既然能申请堆外内存,就不让释放.

是不是openjdk最开始没有想过开放堆外内存的功能呢?

毕竟这个功能使用很复杂.

unsafe.

from tencentkona-11.

shiyuexw avatar shiyuexw commented on May 14, 2024

Tencent Kona JDK 11.0.14已支持该特性,通过-XX:+FreeHeapPhysicalMemory 打开这个特性

from tencentkona-11.

shiyuexw avatar shiyuexw commented on May 14, 2024

无进一步需求,关闭该issue

from tencentkona-11.

jiangguilong2000 avatar jiangguilong2000 commented on May 14, 2024

ForcePeriodicGCInterval

试了下ForcePeriodicGCInterval无效,-XX:+FreeHeapPhysicalMemory -XX:ForcePeriodicGCInterval=60000,预期是一分钟一次FULLGC 但发现没有触发,从启动时的FGC @3次一直没有增加上去, @wattsun110
image

from tencentkona-11.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.