Java 8中的默认Full GC间隔是多少? [英] What is the default Full GC interval in Java 8

查看:802
本文介绍了Java 8中的默认Full GC间隔是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们注意到我们的生产服务器上出现了一个奇怪的行为(JavaEE,Wildfly 10)。 Java VM每小时执行一次Full GC,但仍有足够的内存可用。





VM启动参数为:

  -server 
-Xms4g
-Xmx8g

以下参数是不是激活的:

  -Dsun.rmi.dgc.client.gcInterval = 3600000 
-Dsun.rmi.dgc.server.gcInterval = 3600000

那么Java 8中的默认完全GC时间间隔是多少?我如何将其配置为动态的?

解决方案

-Dsun.rmi.dgc.client.gcInterval = 3600000
-Dsun.rmi.dgc.server.gcInterval = 3600000

未被激活。但是,这些属性是这些属性的默认值;即,如果您不指定属性值,则会得到的值。



参考:Oracle的 sun.rmi Properties documentation。


那么Java 8中默认的完整GC时间间隔是多少?


请参阅上面的DCG触发的完整GC。除此之外,当请求时(通过 System.gc() call)或者当JVM决定这是必要的。如果您不使用RMI,则没有固定间隔。


...以及如何将其配置为动态?


如果你的意思是,你如何阻止RMI每小时触发一次完整的GC:


  • 一种方法是为这些属性指定(很多)较大的值。另一种方法是启动JVM与 -XX:+ DisableExplicitGC 标志。注意:这将禁止对 System.gc()全部调用,而不仅仅是RMI的DGC调用。



We noticed a strange behavior on our production server (JavaEE, Wildfly 10). The Java VM do once per hour Full GC although there is still enough memory available.

The VM start parameters are:

-server
-Xms4g
-Xmx8g

The following parameters are not activated:

-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000

So what is the default Full GC interval in Java 8 and how can I configure it to be dynamic?

解决方案

You say that

-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000

are not "activated". However, those are the default values for those properties; i.e. the values that you get if you DON'T specify values for the properties.

Reference: Oracle's sun.rmi Properties documentation.

So what is the default Full GC interval in Java 8

See above for the DCG triggered full GCs.

Apart from that, a full GC happens when requested (by a System.gc() call) or when the JVM decides it is necessary. There is no fixed interval if you are not using RMI.

... and how can I configure it to be dynamic?

If you mean, how can you stop RMI from triggering a full GC every hour:

  • One way is to specify (much) larger values for those properties.

  • Another way is to launch the JVM with the -XX:+DisableExplicitGC flags. Note: this will disable all calls to System.gc() not just the calls that RMI's DGC makes.

这篇关于Java 8中的默认Full GC间隔是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆