gpt4 book ai didi

java - glassfish 每小时一次完整GC

转载 作者:行者123 更新时间:2023-12-02 14:45:20 25 4
gpt4 key购买 nike

我在 Glassfish 应用程序中大约每小时一次看到一次完整的 GC。 GC 日志摘录:

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]

只要 Glassfish 启动,这种模式就会大致重复。中间的“...”是增量GC。这个时间安排似乎非常可疑——为什么我们会每小时看到一次完整的 GC?

JVM启动参数:

-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

根据 JVisualVM 的说法,我们距离耗尽堆空间还很远。

Glassfish 3.1.2.2、Oracle JDK 1.6.0_45、Windows Server 2008

最佳答案

我怀疑您的 RMI 正在触发完全清理。

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

两者

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).

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).

默认每小时检查一次。

我会将这些设置为一天或一周,因为您认为您不需要这些。

关于java - glassfish 每小时一次完整GC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17028363/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com