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
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.
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.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 toSystem.gc()
not just the calls that RMI's DGC makes.Another solution would be to set the option
in combination with
This way System.gc() will not be disabled but less harmful by making the GC work in concurrent mode instead of causing "stop the world" situations. I used this to successfully reduce my GC pauses in WildFly from 10 seconds to 500ms.