Modifying Java memory settings

Edge for Private Cloud v4.19.01

Depending on your traffic and processing requirements you may need to change the heap memory size or class metadata size for your nodes running Java-based Private Cloud components.

This section provides the default and recommended Java heap memory sizes, as well as the process for changing the defaults. Lastly, this section describes how to change other JVM settings using properties files.

Default and recommended heap memory sizes

The following table lists the default and recommended Java heap memory sizes for Java-based Private Cloud components:

Component Properties File Name Default
Heap Size
Recommended
Heap Size
Runtime
Cassandra n/a Automatically configured1 Automatically configured1
Message Processor message‑processor.properties 512MB 3GB - 6GB2
Router router.properties 512MB 512MB
Analytics
Postgres server postgres‑server.properties 512MB 512MB
Qpid server qpid‑server.properties 512MB 2GB - 4GB
Management
Management Server management‑server.properties 512MB 512MB
UI ui.properties 512MB 512MB
OpenLDAP n/a Native App3 Native App3
Zookeeper zookeeper.properties 2048MB 2048MB
Notes

1 Cassandra dynamically calculates the maximum heap size when it starts up. Currently, this is one half the total system memory, with a maximum of 8192MB. For information on setting the heap size, see Change heap memory size.

2 For Message Processors, Apigee recommends that you set the heap size to between 3GB and 6GB. Increase the heap size beyond 6GB only after conducting performance tests.

If the heap usage nears the max limit during your performance testing, then increase the max limit. For information on setting the heap size, see Change heap memory size.

3 Not all Private Cloud components are implemented in Java. Because they are not Java-based, apps running natively on the host platform do not have configurable Java heap sizes; instead, they rely on the host system for memory management.

To determine how much total memory Apigee recommends that you allocate to your Java-based components on a node, add the values listed above for each component on that node. For example, if your node hosts both the Postgres and Qpid servers, Apigee recommends that your combined memory allocation be between 2.5GB and 4.5GB.

For a list of required hardware (such as RAM), see Installation requirements.

Change heap memory sizes

To change heap memory settings, edit the properties file for the component. For example, for the Message Processor, edit the /opt/apigee/customer/application/message-processor.properties file.

If the message-processor.properties file does not exist, or if the corresponding .properties file for any Edge component does not exist, create it and then change ownership of the file to the "apigee" user, as the following example shows:

chown apigee:apigee /opt/apigee/customer/application/message-processor.properties

If the component is installed on multiple machines, such as the Message Processor, then you must edit the properties file on all machines that host the component.

The following table lists the properties that you edit to change heap sizes:

Property Description
bin_setenv_min_mem

The minimum heap size. The default is based on the values listed in Default and recommended heap memory sizes.

This setting corresponds to the Java -Xms option.

bin_setenv_max_mem

The maximum heap size. The default is based on the values listed in Default and recommended heap memory sizes.

This setting corresponds to the Java -Xmx option.

bin_setenv_meta_space_size

The default class metadata size. The default value is set to the value of bin_setenv_max_permsize, which defaults to 128 MB. On the Message Processor, Apigee recommends that you set this value to 256 MB or 512 MB, depending on your traffic.

This setting corresponds to the Java -XX:MetaspaceSize option.

When you set heap size properties on a node, use the "m" suffix to indicate megabytes, as the following example shows:

bin_setenv_min_mem=4500m
bin_setenv_max_mem=4500m
bin_setenv_meta_space_size=1024m

After setting the values in the properties file, restart the component:

/opt/apigee/apigee-service/bin/apigee-service component restart

For example:

/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart

Change other JVM properties

For Java settings not controlled by the properties listed above, you can also set the following in the corresponding properties file for any Edge component:

  • bin_setenv_ext_jvm_opts: Set any Java property not specified by other properties. For example:
    bin_setenv_ext_jvm_opts=-XX:MaxGCPauseMillis=500

    However, do not use bin_setenv_ext_jvm_opts to set -Xms, -Xmx, or -XX:MetaspaceSize as these values are controlled by the properties listed above.

For additional tips on configuring memory for Private Cloud components, see this article on the Edge forums.