The JVM offers various configuration parameters to control the Java heap memory that is used to run a Java program. The most
important parameters are
-Xmx<value>, which respectively indicate the minimum and the maximum size of the heap memory. The minimum size is the amount of memory
allocated on JVM startup. The maximum size is the hard limit on memory allocation: the Java runtime will throw a java.lang.OutOfMemoryError
when it needs to allocate more memory on the heap than this.
By default, a JVM has typically an initial heap size of 4 MB and a maximum heap size of 64 MB, though these numbers can vary depending on the platform. Most Java EE application servers or servlet containers use the default heap size to run deployed applications, but this is in general too limited for data-driven applications like an OGC web server. Although LuciadLightspeed applies the concept of lazy data loading as often as possible, there is still a need for sufficient memory to load requested data.
Decoded models are also cached using Java
SoftReference objects by default. You still have to ensure sufficient memory is available, though, to prevent the need for frequent garbage
collection. It is therefore recommended to adjust these heap size settings, in order to prevent out-of-memory problems and
to achieve an optimal performance.
Which parameters should be used highly depends on the configured datasets in the OGC web server and on the hardware platform that is used. It is therefore advisable to profile the actual memory usage of the application at runtime in order to determine the right parameters. For optimal performance, set the minimum and the maximum heap size to the same value. This eliminates the need for incremental increases at runtime, which can reduce performance.
On some platforms, such as Unix and Linux, it may not be possible to run a Java application that uses AWT classes like the
LuciadLightspeed WMS server in an environment without a display. To resolve this, JDK 1.4 and later versions include a property
that allows to run the application in a headless environment: