Why does the JVM of these Tomcat servers perform a full GC hourly?

前端 未结 2 1946
情深已故
情深已故 2021-02-01 04:03

We run many Tomcat servers and have observed full garbage collections (GCs) are often performed on an hourly basis, particularly when memory usage is relatively low. The precise

相关标签:
2条回答
  • 2021-02-01 04:10

    you should be able to change the interval by

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

    take a look here https://docs.oracle.com/cd/E19199-01/817-2180-10/pt_chap5.html

    0 讨论(0)
  • 2021-02-01 04:28

    Your "regular" hourly GCs are probably due to this known bug, "The JreMemoryLeakPreventionListener causes a full GC every hour when gcDaemonProtection=true".

    Confirm your Tomcat versions and the value of the gcDaemonProtection property of your JreMemoryLeakPreventionListener (default is true).

    The patch was purportedly included in Tomcat v.7.0.28+ and v.6.0.36+.

    Either upgrade your server(s), or choose a non-upgrading solution from here, summarized as:

    1. suppress full garbage collections using JVM arg -XX:+DisableExplicitGC
    2. keep the full GCs, but defer to the CMS collector using JVM arg -XX:+ExplicitGCInvokesConcurrent
    3. set <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" gcDaemonProtection="false"/>
    4. Disable the listener

    Credit where credit is due; I obtained my initial answer from here.

    0 讨论(0)
提交回复
热议问题