If you have a Java app that handles large volumes of data but your app hangs randomly for several seconds (or even minutes), a good call will be a wrong configuration of Java's Garbage Collection. What can be done?
First of all lets get some of the garbage collector's logs.
In order to see the GC's logging (Stdout) details, use these command line parameters:
Eg: java -jar -verbose:gc -XX:+PrintGCTimeStamps java_app.jar
Now to the actual garbage collecting.
Apparently Java 1.5 has three different fixed garbage collection modes.
The fixed garbage collection modes are:
Eg: java -jar -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseParallelGC java_app.jar
If you find the fixed garbage collection modes not satisfying enough, you can configure the garbage collector manually with several additional command line parameters, use the second link at the bottom of the page for more details.
I strongly recommend the following links that refer to Java's garbage collector: