When investigating the cause of long garbage collection cycles, it is often useful to enable GC logging, which is link:enable gc logging.adoc[documented here]. Once this is enabled, you can look through the GC log file for signs of problems.

When looking for Full GC messages, pay special attention to the details of the message.

If you see something like:

2015-06-09T10:02:16.238-0400: 3571.628: [Full GC (System.gc())  8093M->6655M(24G), 22.3031445 secs]
[Eden: 1464.0M(4456.0M)->0.0B(4456.0M) Survivors: 0.0B->0.0B Heap: 8093.5M(24.0G)->6655.4M(24.0G)], [Metaspace: 89264K->89264K(1132544K)]
[Times: user=31.56 sys=0.01, real=22.30 secs]

In this case you are likely looking at a situation where the application code is invoking a full garbage collection cycle, whether or not it is needed. It is recommended to allow the JVM to make decisions on how and when to run garbage collection so as not to force unnecessary “stop the world” events.


Dave Gordon
Applicable versions:
garbage collectionheapJVMloggingmemoryneo4j-2.0neo4j-2.1neo4j-2.2neo4j-2.3