Tomcat 垃圾回收
Tomcat Garbage Collection
最近我们的 Tomcat 实例停止了,catalina.out 中没有显示任何日志,尽管 CPU 使用率非常低,只有 5% 左右。而htop显示使用的内存只有377MB/1000MB。
所以我启用了详细日志记录。我发现每次问题都发生了。我会看到这样的东西:
855.476: [GC855.476: [DefNew: 4342K->59K(4800K), 0.0018170 秒] 88755K->84472K(103080K), 0.0019020 秒] [时间: user=0.00 sys=0.00, real=0.00秒]
860.850: [GC860.850: [DefNew: 4347K->71K(4800K), 0.0017130 秒] 88760K->84483K(103080K), 0.0017890 秒] [时间: user=0.00 sys=0.00, real=0.00秒]
而且我想检查如何阅读以上两行。
This article 有很好的垃圾回收信息。
[GC [DefNew: 64575K->959K(64576K), 0.0457646 secs]
196016K->133633K(261184K), 0.0459067 secs]
indicates that the minor collection recovered about 98% of the young
generation, DefNew: 64575K->959K(64576K) and took 0.0457646 secs
(about 45 milliseconds).
The usage of the entire heap was reduced to about 51%
196016K->133633K(261184K) and that there was some slight additional
overhead for the collection (over and above the collection of the
young generation) as indicated by the final time of 0.0459067 secs.
最近我们的 Tomcat 实例停止了,catalina.out 中没有显示任何日志,尽管 CPU 使用率非常低,只有 5% 左右。而htop显示使用的内存只有377MB/1000MB。
所以我启用了详细日志记录。我发现每次问题都发生了。我会看到这样的东西:
855.476: [GC855.476: [DefNew: 4342K->59K(4800K), 0.0018170 秒] 88755K->84472K(103080K), 0.0019020 秒] [时间: user=0.00 sys=0.00, real=0.00秒]
860.850: [GC860.850: [DefNew: 4347K->71K(4800K), 0.0017130 秒] 88760K->84483K(103080K), 0.0017890 秒] [时间: user=0.00 sys=0.00, real=0.00秒]
而且我想检查如何阅读以上两行。
This article 有很好的垃圾回收信息。
[GC [DefNew: 64575K->959K(64576K), 0.0457646 secs] 196016K->133633K(261184K), 0.0459067 secs]
indicates that the minor collection recovered about 98% of the young generation, DefNew: 64575K->959K(64576K) and took 0.0457646 secs (about 45 milliseconds).
The usage of the entire heap was reduced to about 51% 196016K->133633K(261184K) and that there was some slight additional overhead for the collection (over and above the collection of the young generation) as indicated by the final time of 0.0459067 secs.