Java and System Environment Settings Configuration
There are two files that control environment settings for Cassandra:
- conf/cassandra-env.sh - Java Virtual Machine (JVM) configuration settings
- bin/cassandra-in.sh - Sets up Cassandra environment variables such as CLASSPATH and JAVA_HOME.
Heap Sizing Options
If you decide to change the Java heap sizing, both MAX_HEAP_SIZE and HEAP_NEWSIZE should should be set together in conf/cassandra-env.sh (if you set one, set the other as well).
See the section on Tuning the Java Heap for more information on choosing the right Java heap size.
- MAX_HEAP_SIZE - Sets the maximum heap size for the JVM. The same value is also used for the minimum heap size. This allows the heap to be locked in memory at process start to keep it from being swapped out by the OS. Defaults to half of available physical memory.
- HEAP_NEWSIZE - The size of the young generation. The larger this is, the longer GC pause times will be. The shorter it is, the more expensive GC will be (usually). A good guideline is 100 MB per CPU core.
Cassandra exposes a number of statistics and management operations via Java Management Extensions (JMX). Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring Java applications and services. Any statistic or operation that a Java application has exposed as an MBean can then be monitored or manipulated using JMX. JConsole, nodetool and DataStax OpsCenter are examples of JMX-compliant management tools.
By default, the conf/cassandra-env.sh file configures JMX to listen on port 7199 without authentication. See the table below for more information on commonly changed JMX configuration properties.
- com.sun.management.jmxremote.port - The port on which Cassandra listens from JMX connections.
- com.sun.management.jmxremote.ssl - Enable/disable SSL for JMX.
- com.sun.management.jmxremote.authenticate - Enable/disable remote authentication for JMX.
- -Djava.rmi.server.hostname - Sets the interface hostname or IP that JMX should use to connect. Uncomment and set if you are having trouble connecting.
Further Reading on JVM Tuning
The remaining options are optimal across a wide variety of workloads and environments and are not frequently changed. See the Sun JVM options list for more information on JVM tuning parameters.