Long garbage collection time experienced by our client in our java web-app (JAVA 8, Tomcat 9) and eventually the application gets suspended indefinitely. Dynatrace performance management tool log throws Long garbage collection time error quiet frequently. Server RAM is 32GB, the Heap size was increased from 1 to 4 GB, and still the error gets thrown but with less frequency than before. JAVA 8 uses parallel collector by default, so is there anything else that can be configured to improve the GC time? Longer GC time indicates large amount of memory objects needs to be recovered, and hence further adding memory may not be ideal.
Does setting The maximum pause time goal parameter will be any useful at all?
-XX:MaxGCPauseMillis=<N>
You first should understand what is allocating too much memory.
There are many different things which can be related, including memory leaks, unnecessary high memory allocation, large allocations inside loops or even actual memory demand of the application being higher than you think.
As you seem to have Dynatrace available, you can use "Memory Profiling" to analyze and pin-point which code-places are actually causing to much GC time here, maybe there is some simple optimization to reduce memory allocations.