Cassandra JVM Options
Configure JVM settings for optimal Cassandra performance.
Configuration Files
Section titled “Configuration Files”| JDK Version | File |
|---|---|
| JDK 11+ | jvm11-server.options |
| JDK 17+ | jvm17-server.options |
Location: /etc/cassandra/
Heap Configuration
Section titled “Heap Configuration”# jvm11-server.options
# Set heap size (same for min and max)-Xms16G-Xmx16G
# Guidelines:# - Max 31GB (compressed oops)# - 1/4 of total RAM typically# - Leave room for OS page cacheHeap Sizing Guidelines
Section titled “Heap Sizing Guidelines”| RAM | Heap Size | Notes |
|---|---|---|
| 8GB | 4GB | Development |
| 32GB | 8GB | Small production |
| 64GB | 16GB | Standard production |
| 128GB+ | 31GB | Max recommended |
Garbage Collection
Section titled “Garbage Collection”G1GC (Recommended)
Section titled “G1GC (Recommended)”-XX:+UseG1GC-XX:MaxGCPauseMillis=500-XX:InitiatingHeapOccupancyPercent=70-XX:ParallelGCThreads=16-XX:ConcGCThreads=4-XX:+ParallelRefProcEnabledZGC (JDK 17+)
Section titled “ZGC (JDK 17+)”-XX:+UseZGC-XX:SoftMaxHeapSize=28G# -XX:+ZGenerational # JDK 21+ only, improves GC efficiencyGC Logging
Section titled “GC Logging”# JDK 11+-Xlog:gc*:file=/var/log/cassandra/gc.log:time,uptime:filecount=10,filesize=10MMemory Settings
Section titled “Memory Settings”# Metaspace-XX:MetaspaceSize=128M-XX:MaxMetaspaceSize=256M
# Direct memory (off-heap)-XX:MaxDirectMemorySize=4G
# String deduplication-XX:+UseStringDeduplicationPerformance Options
Section titled “Performance Options”# Disable explicit GC calls-XX:+DisableExplicitGC
# Large pages (if enabled in OS)-XX:+UseLargePages
# Thread stack size-Xss256kDebug Options
Section titled “Debug Options”# Heap dump on OOM-XX:+HeapDumpOnOutOfMemoryError-XX:HeapDumpPath=/var/lib/cassandra/
# Print GC details (JDK 8 style for reference)# Deprecated in JDK 11+, use Xlog insteadComplete Example
Section titled “Complete Example”# Heap-Xms16G-Xmx16G
# GC-XX:+UseG1GC-XX:MaxGCPauseMillis=500-XX:InitiatingHeapOccupancyPercent=70
# GC Logging-Xlog:gc*:file=/var/log/cassandra/gc.log:time,uptime:filecount=10,filesize=10M
# Metaspace-XX:MetaspaceSize=128M-XX:MaxMetaspaceSize=256M
# Error handling-XX:+HeapDumpOnOutOfMemoryError-XX:HeapDumpPath=/var/lib/cassandra/
# Performance-XX:+DisableExplicitGC-XX:+UseStringDeduplicationNext Steps
Section titled “Next Steps”- cassandra.yaml - Main configuration
- Performance Tuning - Optimization
- Monitoring - JVM monitoring