Configure Cassandra

This document covers the configuration of Cassandra 3.11.X, included with Apigee Edge for Private Cloud versions 4.52.02 or later. Refer to the appendix section for details on performing the configurations described here.

Garbage collector configuration

Switch to using CMS

By default, Apigee ships Cassandra with the G1 Garbage Collector, which is recommended for Cassandra 3.X. However, for varied use cases and your own infrastructure, as in Edge for Private Cloud, you may choose to switch to the CMS Garbage Collector. For heap sizes larger than 8 GB, Apigee strongly recommends using G1GC.

To use the CMS Garbage Collector, set the following configuration:

conf_jvm_options_gc_type=cms

To revert to using the G1 Garbage Collector, remove this configuration.

Modify CMS garbage collector settings

Apigee provides default parameters for the CMS Garbage Collector. These parameters apply when Cassandra uses CMS. To change these parameters, use the config conf_jvm_options_cms_gc_setting_lines. Set all relevant JVM parameters for CMS GC in a single line, separated by “\n”.

Example:

conf_jvm_options_cms_gc_setting_lines=-XX:+UseParNewGC\n-XX:+UseConcMarkSweepGC\n-XX:+CMSParallelRemarkEnabled\n-XX:SurvivorRatio=8\n-XX:MaxTenuringThreshold=1\n-XX:CMSInitiatingOccupancyFraction=75\n-XX:+UseCMSInitiatingOccupancyOnly\n-XX:CMSWaitDuration=10000\n-XX:+CMSParallelInitialMarkEnabled\n-XX:+CMSEdenChunksRecordAlways\n-XX:+CMSClassUnloadingEnabled

Modify G1GC garbage collector settings

Apigee provides default parameters for the G1 Garbage Collector. These parameters apply when the default G1GC is enabled. If you switch to CMS, these settings do not apply. To change the G1GC parameters, use the config conf_jvm_options_g1_gc_setting_lines. Set all relevant JVM parameters for G1 GC in a single line, separated by “\n”.

Example:

conf_jvm_options_g1_gc_setting_lines=-XX:+UseG1GC\n-XX:G1RSetUpdatingPauseTimePercent=5\n-XX:MaxGCPauseMillis=500\n-XX:InitiatingHeapOccupancyPercent=50\n-XX:ParallelGCThreads=8\n-XX:ConcGCThreads=8\n-XX:+ParallelRefProcEnabled\n-XX:MaxTenuringThreshold=1\n-XX:G1HeapRegionSize=32m\n-XX:G1ReservePercent=15

Use your own GC settings

To ignore all of Apigee’s presets for both G1GC and CMS, set the following configs:

conf_jvm_options_gc_type=custom

Specify all GC settings for the JVM in conf_jvm_options_custom_settings, separating each setting by “\n”.

Example:

conf_jvm_options_gc_type=custom
conf_jvm_options_custom_settings=-XX:+UseParallelGC\n-XX:GCTimeRatio=19

Configuring heap sizes

Apigee strongly recommends operating Cassandra with no more than 8 GB of heap space. Checks to limit the heap size to 8 GB are in $APIGEE_ROOT/apigee-cassandra/conf/cassandra-env.sh.

To specify your own heap sizing without manually disabling checks, use the config conf_jvm_options_custom_settings. Separate each setting by “\n”.

Example:

conf_jvm_options_custom_settings=-Xmx8G\n-Xms8G

Configuring general JVM settings

To add JVM parameters to Cassandra, specify all JVM configurations in a single line separated by “\n” for the config conf_jvm_options_custom_settings.

Example:

conf_jvm_options_custom_settings=-Dcassandra.start_rpc=true\n-Dcassandra.expiration_date_overflow_policy=CAP\n-XX:+FlightRecorder\n-XX:+UnlockCommercialFeatures

Appendix

How to set any Cassandra configuration

  1. Create or edit the Cassandra configuration override file:
    vi $APIGEE_ROOT/customer/application/cassandra.properties
  2. Add, remove, or modify the configuration line as required.
  3. Save the file and ensure it is owned and readable by the “apigee” user:
    chown apigee:apigee $APIGEE_ROOT/customer/application/cassandra.properties
  4. Restart the Cassandra service on the node:
    apigee-service apigee-cassandra restart
  5. Repeat these steps on each Cassandra node, one by one.

Varied types of configuration

The configuration conf_jvm_options_custom_settings can pass different parameters to the Cassandra JVM. Combine various Java parameters into a single configuration and separate by “\n”.

Example:

conf_jvm_options_custom_settings=-XX:+FlightRecorder\n-XX:+UnlockCommercialFeatures\n-Xmx8G\n-Xms8G