简体   繁体   English

java 垃圾收集日志条目“Full GC (System)”是否意味着某些 class 称为 System.gc()?

[英]Does java garbage collection log entry “Full GC (System)” mean some class called System.gc()?

What does "Full GC (System)" entry in the garbage collection logs mean?垃圾回收日志中的“Full GC (System)”条目是什么意思? That some class called System.gc()?一些 class 调用 System.gc()?

My garbage collection logs has two different entry types for 'full gc'?我的垃圾收集日志有两种不同的“完整 gc”条目类型? One with the word 'System', the other without.一个带有“系统”一词,另一个没有。 What's the difference?有什么不同?

(Update: I searched on this term and didn't find a definitive answer, only a few questions. So I thought I'd post it). (更新:我搜索了这个词并没有找到明确的答案,只有几个问题。所以我想我会发布它)。

System:系统:

164638.058: [Full GC (System) [PSYoungGen: 22789K->0K(992448K)] [PSOldGen: 1645508K->1666990K(2097152K)] 1668298K->1666990K(3089600K) [PSPermGen: 164914K->164914K(166720K)], 5.7499132 secs] [Times: user=5.69 sys=0.06, real=5.75 secs] 164638.058:[完整GC (系统) [Psyounggen:22789K-> 0K(992448K)] [PSOLDGEN:1645508K--> 1666990K(2097152K)] 1668298K--> 16669990K(30899666666600-1611114) secs] [Times: user=5.69 sys=0.06, real=5.75 secs]

No-System:无系统:

166687.013: [Full GC [PSYoungGen: 126501K->0K(922048K)] [PSOldGen: 2063794K->1598637K(2097152K)] 2190295K->1598637K(3019200K) [PSPermGen: 165840K->164249K(166016K)], 6.8204928 secs] [Times: user=6.80 sys=0.02, real=6.81 secs] 166687.013:[完整GC [Psyounggen:126501K-> 0K(922048K)]时间:user=6.80 sys=0.02, real=6.81 secs]

GC Options GC 选项

Our gc-related java memory options are: -Xloggc:../server/pe/log/jvm_gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails我们与 gc 相关的 java memory 选项是: -Xloggc:../server/pe/log/jvm_gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails

We do not '-XX:+DisableExplicitGC', so it's possible some errant class does call System.gc()我们没有'-XX:+DisableExplicitGC',所以可能有些错误的 class 确实调用了 System.gc()

fwiw, our full jvm options:首先,我们完整的 jvm 选项:

-Xms3072m -Xmx3072m -XX:+HeapDumpOnOutOfMemoryError -XX:-UseGCOverheadLimit -Xloggc:../server/pe/log/jvm_gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:MaxPermSize=256m -XX:+UseCompressedOops -Xms3072m -Xmx3072m -XX:+HeapDumpOnOutOfMemoryError -XX:-UseGCOverheadLimit -Xloggc:../server/pe/log/jvm_gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:MaxPermSize=256m -XX:+UseCompressedOops

thanks in advance,提前致谢,

will将要

From the source for OpenJDK I would say it is从 OpenJDK 的源代码我会说它是

const bool is_system_gc = gc_cause == GCCause::_java_lang_system_gc;

// This is useful for debugging but don't change the output the
// the customer sees.
const char* gc_cause_str = "Full GC";
if (is_system_gc && PrintGCDetails) {
  gc_cause_str = "Full GC (System)";
}

I created a custom version of the Runtime class to record the thread name and stack trace to a file whenever Runtime.getRuntime().gc() was called.我创建了运行时 class 的自定义版本,以便在调用 Runtime.getRuntime().gc() 时将线程名称和堆栈跟踪记录到文件中。 (System.gc() calls this) I found it useful in tracking down and removing such callers. (System.gc() 调用它)我发现它在跟踪和删除此类调用者方面很有用。

One place this happens is in sun.misc.GC class.发生这种情况的一个地方是 sun.misc.GC class。 The RMI will ask this class to ensure a GC has been performing in the last N seconds. RMI 将询问此 class 以确保在最后 N 秒内一直在执行 GC。 If there has been no GC it triggers a full GC.如果没有 GC,它会触发完整的 GC。

This only shows as a problem if you reduce the number of minor GCs.如果您减少次要 GC 的数量,这只会显示为一个问题。 Ironicly it can mean you get more full GCs.具有讽刺意味的是,这可能意味着您获得更多完整的 GC。 ;) ;)

I don't use RMI (except perhaps JConsole) So I have it set to a week.我不使用 RMI(也许 JConsole 除外)所以我将它设置为一周。 (Think the default is an hour) (认为默认是一个小时)

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

I test explicit GC on my mac, it do show "Full GC (System)" when using jdk 1.6, but show "Full GC" with jdk 1.7我在我的 mac 上测试显式 GC,它在使用 jdk 1.6 时确实显示“Full GC (System)”,但在 jdk 1.7 时显示“Full GC”

So don't rely on the "System" label when you tuning GC log unless you know exactly about running environment and jdk version number所以在调整 GC 日志时不要依赖“系统”label,除非您确切了解运行环境和 jdk 版本号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM