Tuesday, August 11, 2009

Weblogic Server JVM Heap Settings

The Java Virtual machine heap size determines how often and how long the VM spends collecting garbage. An acceptable rate for garbage collection is application-specific and should be adjusted after analyzing the actual time and frequency of garbage collections. If you set a large heap size, full garbage collection is slower, but it occurs less frequently. If you set your heap size in accordance with your memory needs, full garbage collection is faster, but occurs more frequently.

Useful Pointers
1) It is recommended to have the min. and max. heap size to be the same for the JVM process referred by, -Xms, -Xmx. This helps in better performance because the JVM need not increase the heap size during the runtime.

2) -Xms1024m -Xmx1024m However, setting 512M in max. heap is the good starting point. But, setting the flag, -verbosegc along with the other JVM parameters, you can determine on how the garbage collection is happening and how long it is taking.

3) The values for the parameters like, -XX:NewSize and -XX:MaxNewSize should be atleast 1/4th value of the max. heap size that you specify for the JVM process.

4) You may need to verify the CPU utilization on the boxes running WLS to verify if the CPU is underutilized or overutilized. If you are seeing that you are underutilizing the cpu, you may add more WLS instances on the same box.

5) The max. heap size that you can specify for the JVM process can be upto 80% of the available memory (RAM) on the system for having optimal performance although specifying a very high heap size is not advisable because garbage collector should go over a large stack to do the garbage collection which may take a long time. So, it is advisable to enable verbosegc to see the best results in garbage collection to decide the right heap size for the JVM.

6) The other default JVM parameter, -XX:MaxPermSize=128m provided in the startup scripts is also required for JVM process which is the allocation of the space for permanent objects within the jvm session which never gets garbage collected. Please ensure that, this value is min. of 128m and should be 1/4th the max. heap size that you specify and you may increase to 1/3rd if you use lot of XML parsing within your applications.

No comments:

Post a Comment