Consultor Eletrônico



Kbase P30042: How to determine JVM heap size; -mx, -ms?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/07/2003
Status: Unverified

GOAL:

How to determine JVM heap size; -mx, -ms?

FIX:

This solution is designed to help you determine optimal JVM heap size.

The following information has been taken from; http://www-106.ibm.com/developerworks/library/j-tip-heap-size.html

In most cases, you should set the mx parameter if you believe the heap is too small for the Java application. By monitoring the output of the JVM running with the verbosegc parameter on the Java command line, you can determine if too much garbage collection is occurring. If garbage collection is too frequent, try increasing the heap size. In general, we recommend that you increase the mx parameter if the application keeps getting Out-of-Memory errors. These errors may be caused by lack of free space in the Java heap.

While there are few rules for setting the heap size, the following guidelines may be helpful:

1. Do not let your heap grow larger than the physical memory of your system. In other words, never set your mx heap size larger than [(physical memory) - (working set size of operating system and applications)]. Also, if you run multiple JVMs, the sum of all heaps sizes should be less than the above calculated value.

2. Set the mx parameter if the application requires a heap larger than one-half the total physical memory size.

3. If your application is dependent on finalizers operating frequently, you may need to reduce the size of your mx setting.

The ms parameter is easier. If you are concerned about memory utilization and expansion overhead, set the value of ms to the value of mx.