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:
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