Garbage collection impacts to Java performance

The most common performance problem associated with Java™ relates to the garbage collection mechanism.

If the size of the Java heap is too large, the heap must reside outside main memory. This causes increased paging activity, which affects Java performance.

Also, a large heap can take several seconds to fill up. This means that even if garbage collection occurs less frequently, pause times associated with garbage collection increase.

To tune the Java Virtual Machine (JVM) heap, use the java command with the -ms or -mx option. Use the garbage collection statistics to help determine optimal settings.