Knowledge Base

Long GC Pauses caused by application code calling System.gc()

When investigating the cause of long garbage collection cycles, it is often useful to enable GC logging.

You can do so by following the product documentation.

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:

2019-05-02 17:53:16.622+0100 WARN [o.n.k.i.c.VmPauseMonitorComponent] Detected VM stop-the-world pause: {pauseTime=566, gcTime=596, gcCount=1}

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.

Do not to explicitly trigger "stop the world" events by calling System.gc().