Setting heap memory size for the publication and subscription servers v7

The publication server and the subscription server are configured to run with a default set of heap size parameters. The default settings for 32-bit platforms and the default settings for 64-bit platforms are set by the parameter JAVA_HEAP_SIZE when Replication Server is installed.

Configure this parameter in the Replication Server startup configuration file. See Replication Server startup configuration file.

The following is an example of the Replication Server startup configuration file.

#!/bin/sh

JAVA_EXECUTABLE_PATH="/usr/bin/java"
JAVA_MINIMUM_VERSION=1.8
JAVA_BITNESS_REQUIRED=64
JAVA_HEAP_SIZE="-Xms2048m -Xmx4096m"
PUBPORT=9051
SUBPORT=9052

On a 32-bit system, the initial heap size is set to 128 megabytes (-Xms128m) and the maximum limit is set to 512 megabytes (-Xmx512m). On a 64-bit system the initial heap size is 256 megabytes (-Xms256m) and the maximum limit is 1536 megabytes (-Xmx1536m).

Typically, these values can handle the average workloads. However, depending on the average row size and pending backlog of replication updates, it might help to increase the default heap size settings.

You can change the default values by changing the JAVA_HEAP_SIZE parameter setting in the Replication Server startup configuration file. Be sure to restart the publication server and the subscription server after making such changes. See Registering a publication server and Registering a subscription server.

The heap size value must conform to the available RAM on the host running the publication server or subscription server. The basic guideline is for the maximum heap size not to exceed 25% of the total RAM size.

If both the publication server and subscription server are running on the same host, then the minimum and recommended RAM capacity are as follows:

  • Minimum RAM Size. For a 32-bit system, use 4 gigabytes; for a 64-bit system use 8 gigabytes.
  • Recommended RAM Size. For a 32-bit system, use 8 gigabytes; for a 64-bit system use 16 gigabytes.

By default, both the publication server and subscription server are started and both are required for single-master replication systems. However, if you're only configuring and using multi-master replication systems, then you don't need the subscription server. In such cases, stop the subscription server to avoid redundant use of memory.

If both the publication server and the subscription server are running on the same host, then each server reserves its own heap buffer. Thus, the total heap size for both the publication and subscription servers, obtained by adding the maximum heap size for both servers, must comply with the available RAM on the host.

Tuning heap size and configuration parameters for larger rows

When one or more publication tables contain a large size column, for example, XMLType (Oracle/EPAS data type), you must adjust specific parameters to avoid Out Of Memory errors. The XMLType column is stored in large objects (LOBs). The LOB storage maintains content accuracy to the original XML. So it retains and stores all the white spaces present in the XML. This data occupies large space when it is loaded and held in memory by Replication Server as part of the replication process.

Tune the following parameters to reduce the data maintained in the memory for XMLType and other large-size columns:

  • Increase HEAP size between 4GB to 8GB depending on the maximum size of large column:
    • 4GB for column size below 30MB
    • 6GB for column size between 30 and 100 BM
    • 8GB for column size > 100 MB
  • Set the configuration parameter txSetMaxSize to a lower value (10 to 50) depending on the average size of row data. For a large column (>100MB), set txSetMaxSize to less than or equal to 5.
  • Set the configuration parameter syncBatchSize to a lower value (4 to 10 rows) depending on the size of the column data. For a very large column (>100MB), set syncBatchSize to less than 4.
Note

Higher values of txSetMaxSize and syncBatchSize boost the performance of the replication process. However, increasing it to a relatively larger value might result in an Out of Memory error. Tune these values based on the column size.