Calculating Maximum Heap Size

A simple way to calculate the value for the -Xmx option is to use the figure for half the available memory on the system and divide that among the number of JVMs that both the application server and 3DSpace Service (if used) are running.

Using system commands, the number of JVMs can be counted manually; however, you should know how to calculate the number of Java processes (JVMs) that should be running since this could help track down any unwanted Java processes during troubleshooting. Read the installation guide that came with your application server, as it should include details of features, such as load balancing, that may add more JVMs than would normally be expected. Because these extra JVMs consume memory, they should be subtracted from the total available memory. One such JVM is the so-called "nanny process," described below.

See Also
Evaluation Details
Process Limitations
The Java Process Command Line

Starting with no applications running on the system, use the methods described in Checking Memory Usage, to find the current amount of available memory. If a high degree of accuracy is required, take readings over several days, and calculate an average value. If the machine runs a backup program, find the amount of memory used by the backup program and subtract it from the amount of available memory. Now you will have determined the actual amount of available memory for the application and 3DSpace Service instances.

Calculating the maximum heap size involves a simple formula that requires knowing the number and type of JVMs that are to run on the machine. The 3DSpace Service instances may or may not be running on the same server; if they are not, the number of JVMs equals the number of JVMs running in the application server. The number of Java processes in the application server depends on whether the server has one or more nanny processes. See your application server guide for information about nanny processes and whether they are used.

Note: The number of application server JVMs denotes the number of Java processes that are configured to support the 3DSpace domain. If a second domain is running on the application server, the amount of available memory is affected by the memory consumed to run that domain and therefore should be subtracted from the current amount of memory to become the available memory figure used in the formulas below.
Note: If a nanny process is used, subtract 128m from the available memory before applying any of the formula below.

Following are the formulas for maximum heap size:

server JVM memory = available memory - 128m
per process memory =  server JVM memory / (number of application server
JVMs)
maximum heap size = per process memory / 2
Note: The 3DSpace Service kernel shares the same process as the application server.