When to Turn On Verbose GC

- This is archive documentation, which means it is not supported or valid for recent versions of Zimbra Collaboration.

Problem

The Zimbra server is running slowly or is not responding to requests.

Background

When major garbage collection is running, server activity pauses. If you notice that the server is not responding or is running slow, garbage collection might be running too frequently.

How to troubleshoot the problem

Run –verbose GC to review the frequency of collections. When you run the verbose GC command, make sure that you include the print timestamp option (-XX:+PrintGCTimeStamp) and the print details option (-XX:+PrintGCDetails). For troubleshooting GC issues, the timestamp and the frequency of garbage collection are important clues.

In a normal garbage collection, the full GC should take a few seconds to run depending on the total heap size. A YoungGen GC should take a few milliseconds. If you notice that the full GC collection occurs frequently, for instance it is running two or more times every five minutes, you may have to tweak the JVM configuration.

In the GC examples below the first detail in each record is the timestamp in seconds that shows when this record started. The timestamp is an offset of the server’s start time. In the first example, the timestamp 1750.263 shows that the server was started about 29 minutes before. The last detail in the record is the time the GC process took, in seconds. The Full GC took about 2 seconds.

GC may be running too frequently because of the following type of issues:

• The heap size is too small. In ZCS, the heap size is a percentage of the RAM. To see the Java heap memory percentage for Tomcat, type:

zmlocalconfig –e tomcat_java_heap_memory_percent.

• The server configuration is causing GC to run too often. For instance, if the indexing cache size is set too large and high loads are exercising the index, the server will need more memory. Review your server mailbox configuration settings, CLI command zmlocalconfig.

• Server memory leak – If you suspect that you have a server memory leak, contact Zimbra Support.

Changing Young Generation Size

The bigger the young generation, the less often minor garbage collection occurs. But a larger young generation implies a smaller old generation, which may increase the frequency of full GC. The NewSize and MaxNewSize parameters determine the new generation’s minimum and maximum size.

In most cases you should not change the default settings. But, if the server is fully loaded and you are seeing frequent full GC Runs, decreasing the NewSize will cause more frequent minor GC runs. This will decrease the frequency of full GC runs.

Caution: If you set the NewSize too small, the survived live objects will be promoted to tenured generation and a full GC will be forced to happen.

Note: If your server’s load is close to the limit, tuning NewSize may cause big performance differences.