JVM Memory Settings and System Performance

Several properties govern how the JVM uses memory. For the Java application, these properties are set by adding parameters to the java invocation. For the cache server, they are added to the command-line parameters for the cacheserver startup script.
  • JVM heap size—Your JVM may require more memory than is allocated by default. For example, you may need to increase heap size for an application that stores a lot of data. You can set a maximum size and an initial size, so if you know you will be using the maximum (or close to it) for the life of the member, you can speed memory allocation time by setting the initial size to the maximum. This sets both the maximum and initial memory sizes to 1024 megabytes for a Java application:
    -Xmx1024m -Xms1024m
    The properties are passed to the cache server on the command line:
    cacheserver start -J-Xmx1024m -J-Xms1024m
  • MaxDirectMemorySize—The JVM has a kind of memory called direct memory, which is distinct from normal JVM heap memory, that can run out. You can increase the direct buffer memory either by increasing the maximum heap size (see previous JVM Heap Size), which increases both the maximum heap and the maximum direct memory, or by only increasing the maximum direct memory using -XX:MaxDirectMemorySize. The following parameter added to the Java application startup increases the maximum direct memory size to 256 megabytes:
    The same effect for the cache server:
    cacheserver start -J-XX:MaxDirectMemorySize=256M