This document covers the configuration of Cassandra 5.0.X, included with Apigee Edge for Private Cloud version 4.54.00 or later. Refer to the [Appendix](https://docs.apigee.com/private-cloud/v4.54.00/cassandra-configuration.md.txt#appendix) section for details on applying the configurations described on this page.

## Garbage collector configuration

### Modify G1GC settings

By default, Apigee ships Cassandra with the G1 Garbage Collector (G1GC) and provides default G1GC parameters. Because Cassandra 5.0.X runs on Java 17, the Concurrent Mark Sweep (CMS) garbage collector (`conf_jvm_options_gc_type=cms` and `conf_jvm_options_cms_gc_setting_lines`) is no longer supported. To change the G1GC parameters, set the `conf_jvm_options_g1_gc_setting_lines` property in a single line with each JVM parameter 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

> [!NOTE]
> **Note:** Settings provided by Apigee and any custom settings you add are not cumulative. Your settings override Apigee's default settings.

### Use your own GC settings

To ignore Apigee's presets for G1GC, set the following configuration:

    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

> [!NOTE]
> **Note:** Setting `conf_jvm_options_gc_type=custom` is an advanced configuration that Apigee doesn't recommend. If an issue arises in Cassandra, Apigee recommends reverting to the preset G1GC settings before troubleshooting.

## Configure 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

> [!WARNING]
> **Caution:** When specifying heap settings this way, Apigee's checks and restrictions are disabled. Ensure you understand the trade-offs of increasing heap size.

## Configure 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