glassfish full gc once an hour

2019-05-28 01:17发布

I'm seeing a full GC about once an hour in our Glassfish application. Extract from the GC log:

9.210: [Full GC 28311K->27979K(6422528K), 0.3770238 secs]
...
3609.647: [Full GC 1186957K->597880K(6478208K), 4.5102977 secs]
...
7214.192: [Full GC 742184K->595596K(6469504K), 4.3726625 secs]
...
10818.805: [Full GC 756228K->570803K(6455936K), 4.8630472 secs]

And this pattern roughly repeats as long as Glassfish is up. The "..." in between are incremental GCs. The timing seems awfully suspicious- why would we be seeing full GC's about once an hour?

JVM startup parameters:

-Xms6400m
-Xmx6400m
-XX:NewSize=1024m
-XX:MaxNewSize=1024m
-XX:PermSize=256m
-XX:MaxPermSize=1024m
-XX:+UseParallelGC
-XX:+UseParallelOldGC
-Xloggc:C:\glassfish3\glassfish\domains\domain1\logs\gc\gc.log
-XX:+AggressiveOpts
-Xss1024k
-XX:+CMSClassUnloadingEnabled

According to JVisualVM, we're no where close to running out of heap space.

Glassfish 3.1.2.2, Oracle JDK 1.6.0_45, Windows Server 2008

2条回答
2楼-- · 2019-05-28 01:52

I suspect your RMI is triggering a Full clean up.

http://docs.oracle.com/javase/6/docs/technotes/guides/rmi/sunrmiproperties.html

both

sun.rmi.dgc.server.gcInterval

When it is necessary to ensure that unreachable remote objects are unexported and garbage collected in a timely fashion, the value of this property represents the maximum interval (in milliseconds) that the Java RMI runtime will allow between garbage collections of the local heap. The default value is 3600000 milliseconds (one hour).

and

sun.rmi.dgc.client.gcInterval

When it is necessary to ensure that DGC clean calls for unreachable remote references are delivered in a timely fashion, the value of this property represents the maximum interval (in milliseconds) that the Java RMI runtime will allow between garbage collections of the local heap. The default value is 3600000 milliseconds (one hour).

default to hourly checks.

I would set these to a day or a week for you believe you don't need these.

查看更多
地球回转人心会变
3楼-- · 2019-05-28 01:54

You could also try to disable explicit GC (-XX:+DisableExplicitGC) and see if the FullGCs go away.

查看更多
登录 后发表回答