nodetool getcompactionthroughput
Displays the current compaction throughput limit.
Synopsis
Section titled “Synopsis”nodetool [connection_options] getcompactionthroughput [options]See connection options for connection options.
Options
Section titled “Options”| Option | Description |
|---|---|
-d, --precise-mib | Display precise MiB/s value as a decimal (avoids rounding errors when configured value is not an integer) |
Description
Section titled “Description”nodetool getcompactionthroughput returns the maximum rate at which compaction operations can write data, measured in mebibytes per second (MiB/s). The output also includes current throughput metrics for the last 1/5/15 minute intervals. This throttle helps prevent compaction from consuming excessive disk I/O and impacting read/write performance.
Compaction throughput affects:
- SSTable merge operations - How fast SSTables are combined
- Disk I/O utilization - Balance between compaction and client traffic
- Compaction backlog - How quickly pending compactions complete
- Read performance - Fewer SSTables means faster reads
Output
Section titled “Output”Standard Output
Section titled “Standard Output”Current compaction throughput: 64 MiB/sthroughput_1min: 45 MiB/sthroughput_5min: 52 MiB/sthroughput_15min: 48 MiB/sOutput Values
Section titled “Output Values”| Value | Meaning |
|---|---|
64 MiB/s | Default throughput limit |
0 MiB/s | Unlimited (no throttling) |
16-256 MiB/s | Typical operational range |
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool getcompactionthroughputOutput:
Current compaction throughput: 64 MB/sCheck Remote Node
Section titled “Check Remote Node”ssh 192.168.1.100 "nodetool getcompactionthroughput"Cluster-Wide Check
Section titled “Cluster-Wide Check”for node in node1 node2 node3; do echo -n "$node: " ssh "$node" "nodetool getcompactionthroughput"doneExtract Value Only
Section titled “Extract Value Only”nodetool getcompactionthroughput | awk '{print $4}'Output:
64Understanding Compaction Throughput
Section titled “Understanding Compaction Throughput”How Throttling Works
Section titled “How Throttling Works”Cassandra limits the rate at which compaction writes output SSTables:
- Compaction reads input SSTables
- Merges and processes data in memory
- Writes output SSTables at throttled rate
- Rate is controlled by compaction throughput setting
Impact of Different Values
Section titled “Impact of Different Values”| Throughput | Compaction Speed | I/O Impact | Use Case |
|---|---|---|---|
| 16 MB/s | Very slow | Minimal | Heavy read load |
| 32 MB/s | Slow | Low | Normal production |
| 64 MB/s | Moderate | Moderate | Default/balanced |
| 128 MB/s | Fast | High | Maintenance windows |
| 256+ MB/s | Very fast | Very high | Dedicated compaction |
| 0 (unlimited) | Maximum | Maximum | Recovery/emergency |
When to Use
Section titled “When to Use”Routine Monitoring
Section titled “Routine Monitoring”Check current throughput setting:
nodetool getcompactionthroughputBefore Adjusting
Section titled “Before Adjusting”Verify current value before making changes:
# Check currentnodetool getcompactionthroughput
# Adjust if needednodetool setcompactionthroughput 128
# Verify changenodetool getcompactionthroughputDuring Compaction Issues
Section titled “During Compaction Issues”When investigating compaction performance:
# Check throughput limitnodetool getcompactionthroughput
# Check current compaction activitynodetool compactionstats
# Check if throughput is the bottleneck# (compare active rate vs configured limit)Cluster Configuration Audit
Section titled “Cluster Configuration Audit”Verify consistency across nodes:
#!/bin/bash# Check compaction throughput on all nodes
echo "=== Compaction Throughput Audit ==="for node in $(nodetool status | grep "^UN" | awk '{print $2}'); do throughput=$(ssh "$node" "nodetool getcompactionthroughput 2>/dev/null | awk '{print $4}')" echo "$node: $throughput MB/s"doneCorrelation with Compaction Stats
Section titled “Correlation with Compaction Stats”Monitoring Actual Throughput
Section titled “Monitoring Actual Throughput”# Check configured limitnodetool getcompactionthroughput
# Check actual compaction activitynodetool compactionstatsExample compactionstats output:
pending tasks: 5- system_schema.tables: 0- my_keyspace.my_table: 5
Active compaction: Compacting (my_keyspace.my_table) Progress: 45.2% (2.3/5.1 GB) Throughput: 62.5 MB/sIf "Throughput" consistently matches the configured limit, compaction is being throttled.
Signs Throughput is Too Low
Section titled “Signs Throughput is Too Low”| Indicator | Symptom |
|---|---|
| Growing pending tasks | nodetool compactionstats shows increasing backlog |
| High SSTable count | nodetool tablestats shows many SSTables |
| Read latency increase | More SSTables to scan for reads |
| Disk usage growth | Uncompacted data accumulating |
Signs Throughput is Too High
Section titled “Signs Throughput is Too High”| Indicator | Symptom |
|---|---|
| I/O saturation | High disk utilization (iostat) |
| Read/write latency | Client operations slowed |
| Dropped messages | nodetool tpstats shows drops |
| CPU pressure | Compaction using too much CPU |
Default Values
Section titled “Default Values”Default Value
Section titled “Default Value”The default compaction throughput is 64 MB/s in Cassandra 4.x and later.
Configuration File
Section titled “Configuration File”The cassandra.yaml parameter name varies by version:
| Cassandra Version | Parameter Name | Example |
|---|---|---|
| Pre-4.1 | compaction_throughput_mb_per_sec | 64 |
| 4.1+ | compaction_throughput | 64MiB/s |
# cassandra.yaml (4.1+)compaction_throughput: 64MiB/s
# cassandra.yaml (Pre-4.1)# compaction_throughput_mb_per_sec: 64Comparison with Related Settings
Section titled “Comparison with Related Settings”| Setting | Purpose | Command |
|---|---|---|
| Compaction throughput | SSTable write rate limit | getcompactionthroughput / setcompactionthroughput |
| Stream throughput | Node-to-node transfer rate | getstreamthroughput / setstreamthroughput |
| Concurrent compactors | Parallel compaction threads | getconcurrentcompactors / setconcurrentcompactors |
Understanding the Relationship
Section titled “Understanding the Relationship”# Check all compaction-related settingsecho "=== Compaction Settings ==="echo "Throughput: $(nodetool getcompactionthroughput)"echo "Concurrent compactors: $(nodetool getconcurrentcompactors)"echo ""echo "=== Current Activity ==="nodetool compactionstatsEffective throughput = throughput_per_compactor × concurrent_compactors
Tuning Guidelines
Section titled “Tuning Guidelines”When to Increase
Section titled “When to Increase”- Compaction backlog growing
- Many pending compaction tasks
- During maintenance windows
- SSTable count too high
# Check currentnodetool getcompactionthroughput
# Increase for maintenancenodetool setcompactionthroughput 128
# Monitor progresswatch nodetool compactionstatsWhen to Decrease
Section titled “When to Decrease”- High client latencies during compaction
- I/O contention observed
- Disk utilization too high
- During peak traffic periods
# Check currentnodetool getcompactionthroughput
# Reduce to minimize impactnodetool setcompactionthroughput 32
# Verify client latencies improvenodetool proxyhistogramsMonitoring Script
Section titled “Monitoring Script”#!/bin/bash# compaction_monitor.sh - Monitor compaction throughput and activity
while true; do clear echo "=== Compaction Monitor $(date) ===" echo ""
# Configured limit echo "Configured throughput: $(nodetool getcompactionthroughput)" echo ""
# Current activity echo "Current compaction activity:" nodetool compactionstats
echo "" echo "Press Ctrl+C to exit" sleep 10doneTroubleshooting
Section titled “Troubleshooting”Throughput Shows 0
Section titled “Throughput Shows 0”nodetool getcompactionthroughput# Output: Current compaction throughput: 0 MB/sThis means compaction is unlimited (no throttling). This is intentional in some configurations but may cause I/O saturation.
# Set a reasonable limitnodetool setcompactionthroughput 64Value Doesn't Persist After Restart
Section titled “Value Doesn't Persist After Restart”Runtime changes with setcompactionthroughput don't persist. Update cassandra.yaml:
compaction_throughput_mb_per_sec: 64Different Values Across Nodes
Section titled “Different Values Across Nodes”# Audit clusterfor node in node1 node2 node3; do echo "$node: $(ssh "$node" "nodetool getcompactionthroughput | awk '{print $4}')""done
# Output:# node1: 64# node2: 32 # Different!# node3: 64
# Standardizessh node2 "nodetool setcompactionthroughput 64"Best Practices
Section titled “Best Practices”Compaction Throughput Guidelines
- Monitor regularly - Include in operational dashboards
- Consistent across cluster - Use same setting on all nodes
- Adjust for workload - Lower during peak, higher during maintenance
- Balance with streaming - Consider total I/O budget
- Document changes - Log when and why throughput was adjusted
- Persist settings - Update cassandra.yaml for permanent changes
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| setcompactionthroughput | Modify throughput limit |
| compactionstats | View active compactions |
| compactionhistory | View past compactions |
| setstreamthroughput | Set streaming rate |
| tablestats | SSTable counts per table |