Cassandra Configuration Reference
Cassandra configuration is spread across three places: cassandra.yaml for database settings, JVM options files for heap and garbage collection, and OS-level settings for limits and kernel parameters. Changes to some settings take effect immediately; others require a rolling restart.
The defaults prioritize safe startup over performance—Cassandra will run on minimal hardware without crashing, but it will not perform well. Production deployments typically change a dozen or more settings from defaults: larger heap, faster compaction, higher file descriptor limits, and workload-appropriate thread pools.
This reference covers each configuration file and the settings that matter most.
Configuration Files
Section titled “Configuration Files”| File | Purpose | Location |
|---|---|---|
cassandra.yaml | Main configuration | /etc/cassandra/ |
cassandra-env.sh | Environment variables | /etc/cassandra/ |
jvm.options / jvm11-server.options | JVM settings | /etc/cassandra/ |
cassandra-rackdc.properties | DC/rack configuration | /etc/cassandra/ |
logback.xml | Logging configuration | /etc/cassandra/ |
Documentation Structure
Section titled “Documentation Structure”cassandra.yaml
Section titled “cassandra.yaml”- cassandra.yaml Overview - Main configuration
JVM Options
Section titled “JVM Options”- JVM Tuning Overview - Heap and GC settings
Snitch Configuration
Section titled “Snitch Configuration”- Snitch Overview - Topology awareness
Guardrails
Section titled “Guardrails”- Guardrails Reference - Configurable limits to protect cluster stability (Cassandra 4.0+)
Logging
Section titled “Logging”- Logging Configuration (logback.xml) - Log levels, rotation, and output configuration
cassandra.yaml Quick Reference
Section titled “cassandra.yaml Quick Reference”Essential Settings
Section titled “Essential Settings”# Cluster identificationcluster_name: 'ProductionCluster'num_tokens: 16
# Networklisten_address: 10.0.0.1rpc_address: 10.0.0.1native_transport_port: 9042storage_port: 7000
# Seedsseed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "10.0.0.1,10.0.0.2"
# Snitchendpoint_snitch: GossipingPropertyFileSnitch
# Directoriesdata_file_directories: - /var/lib/cassandra/datacommitlog_directory: /var/lib/cassandra/commitlogsaved_caches_directory: /var/lib/cassandra/saved_cacheshints_directory: /var/lib/cassandra/hintsPerformance Settings
Section titled “Performance Settings”# Concurrent operationsconcurrent_reads: 32concurrent_writes: 32concurrent_counter_writes: 32concurrent_materialized_view_writes: 32
# Compaction# 4.0: compaction_throughput_mb_per_sec, 4.1+: compaction_throughput (e.g., 64MiB/s)compaction_throughput_mb_per_sec: 64concurrent_compactors: 2
# Memtablememtable_heap_space_in_mb: 2048memtable_offheap_space_in_mb: 2048memtable_flush_writers: 2
# Commit logcommitlog_sync: periodic# 4.0: _in_ms suffix, 4.1+: duration syntax (e.g., 10s)commitlog_sync_period_in_ms: 10000commitlog_segment_size_in_mb: 32Configuration Syntax Changes in 4.1+
Cassandra 4.1+ introduced duration literals (e.g., 10s, 200ms, 1h) and data rate units (e.g., 64MiB/s). The _in_ms and _mb_per_sec suffixes are deprecated but still accepted. See cassandra.yaml for version-specific parameter names.
Timeout Settings
Section titled “Timeout Settings”# 4.0 syntax shown; 4.1+ uses duration literals (e.g., 5s instead of 5000)read_request_timeout_in_ms: 5000write_request_timeout_in_ms: 2000counter_write_request_timeout_in_ms: 5000range_request_timeout_in_ms: 10000truncate_request_timeout_in_ms: 60000request_timeout_in_ms: 10000Security Settings
Section titled “Security Settings”# Authenticationauthenticator: PasswordAuthenticatorauthorizer: CassandraAuthorizerrole_manager: CassandraRoleManager
# Client encryptionclient_encryption_options: enabled: true optional: false keystore: /etc/cassandra/conf/.keystore keystore_password: cassandra
# Server encryptionserver_encryption_options: internode_encryption: all keystore: /etc/cassandra/conf/.keystore keystore_password: cassandra truststore: /etc/cassandra/conf/.truststore truststore_password: cassandraJVM Options Quick Reference
Section titled “JVM Options Quick Reference”Heap Settings
Section titled “Heap Settings”# jvm11-server.options
# Heap size (set both to same value)-Xms16G-Xmx16G
# Or for auto-sizing (not recommended for production)# -XX:MaxRAMPercentage=50.0G1GC Settings (Recommended)
Section titled “G1GC Settings (Recommended)”# Use G1GC-XX:+UseG1GC
# Pause time target-XX:MaxGCPauseMillis=500
# Other G1 options-XX:G1RSetUpdatingPauseTimePercent=5-XX:InitiatingHeapOccupancyPercent=70
# GC Logging-Xlog:gc*:file=/var/log/cassandra/gc.log:time,uptime:filecount=10,filesize=10MZGC Settings (JDK 17+)
Section titled “ZGC Settings (JDK 17+)”# Use ZGC-XX:+UseZGC-XX:+ZGenerational
# ZGC options-XX:SoftMaxHeapSize=28G # Soft target (under -Xmx)OS-Level Configuration
Section titled “OS-Level Configuration”sysctl Settings
Section titled “sysctl Settings”# Virtual memoryvm.max_map_count = 1048575vm.swappiness = 1
# Networknet.core.rmem_max = 16777216net.core.wmem_max = 16777216net.ipv4.tcp_rmem = 4096 87380 16777216net.ipv4.tcp_wmem = 4096 65536 16777216Limits
Section titled “Limits”cassandra soft memlock unlimitedcassandra hard memlock unlimitedcassandra soft nofile 1048576cassandra hard nofile 1048576cassandra soft nproc 32768cassandra hard nproc 32768Disable Swap
Section titled “Disable Swap”# Temporarysudo swapoff -a
# Permanent# Remove/comment swap entries in /etc/fstabDisable THP
Section titled “Disable THP”echo never > /sys/kernel/mm/transparent_hugepage/enabledecho never > /sys/kernel/mm/transparent_hugepage/defragConfiguration by Workload
Section titled “Configuration by Workload”Read-Heavy Workload
Section titled “Read-Heavy Workload”# More read threadsconcurrent_reads: 64
# Higher key cachekey_cache_size_in_mb: 200
# Leveled compaction (better read performance)# Set per-table via CQL
# Lower bloom filter FP rate# Set per-table: bloom_filter_fp_chance = 0.01Write-Heavy Workload
Section titled “Write-Heavy Workload”# More write threadsconcurrent_writes: 64
# Larger memtablesmemtable_heap_space_in_mb: 4096
# Higher compaction throughputcompaction_throughput_mb_per_sec: 128
# More compaction threadsconcurrent_compactors: 4
# Periodic commit log synccommitlog_sync: periodiccommitlog_sync_period_in_ms: 10000Time-Series Workload
Section titled “Time-Series Workload”# Use TWCS per table (via CQL)# TimeWindowCompactionStrategy with appropriate window
# Set TTL per table# default_time_to_live
# Lower gc_grace for TTL data# gc_grace_seconds: 86400 (per table)
# Disable key cache (usually not useful for time-series)# key_cache_size_in_mb: 0Configuration Validation
Section titled “Configuration Validation”Check Current Config
Section titled “Check Current Config”# Via nodetoolnodetool getlogginglevelsnodetool getstreamthroughputnodetool getcompactionthroughput
# Via CQLSELECT * FROM system.local;SELECT * FROM system_schema.keyspaces;Common Mistakes
Section titled “Common Mistakes”| Mistake | Correct Approach |
|---|---|
| Heap > 31GB | Keep heap ≤ 31GB (compressed oops) |
| swap enabled | Disable swap completely |
| listen_address = localhost | Use actual IP or 0.0.0.0 |
| Only 1-2 seeds | Use 2-3 seeds per DC |
| THP enabled | Disable THP |
| Low file limits | Set to 1M+ |
Next Steps
Section titled “Next Steps”- cassandra.yaml Deep Dive - Every parameter
- JVM Tuning - Heap and GC
- Performance Tuning - Optimization guide
- Production Checklist - Go-live prep