nodetool settimeout
Sets the timeout value for the specified type.
Synopsis
Section titled “Synopsis”nodetool [connection_options] settimeout <timeout_type> <timeout_value_in_ms>See connection options for connection options.
Description
Section titled “Description”nodetool settimeout modifies the timeout value for a specific operation type at runtime. This allows adjusting timeouts without restarting the node, useful for:
- Emergency response - Temporarily increase timeouts during performance issues
- Workload accommodation - Adjust for queries with known longer execution times
- Testing - Experiment with different timeout values
Runtime Change
Timeout changes take effect immediately but don't persist across restarts. For permanent changes, update cassandra.yaml.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
timeout_type | The type of timeout to modify |
timeout_value_in_ms | New timeout value in milliseconds |
Timeout Types
Section titled “Timeout Types”| Type | Description | Default |
|---|---|---|
read | Read operations | 5000 ms |
write | Write operations | 2000 ms |
range | Range read operations | 10000 ms |
counterwrite | Counter write operations | 5000 ms |
cascontention | CAS contention retries | 1000 ms |
truncate | Truncate operations | 60000 ms |
misc | Miscellaneous operations | 10000 ms |
internodeconnect | Internode connections | 10000 ms |
internodeuser | Internode user operations | varies |
internodestreaminguser | Internode streaming user socket timeout | varies |
Zero Value Behavior
For internodestreaminguser, setting the value to 0 disables the socket streaming timeout entirely.
Examples
Section titled “Examples”Increase Read Timeout
Section titled “Increase Read Timeout”nodetool settimeout read 10000Increase Range Timeout
Section titled “Increase Range Timeout”# For large range scansnodetool settimeout range 30000Decrease Write Timeout
Section titled “Decrease Write Timeout”nodetool settimeout write 1000Verify Change
Section titled “Verify Change”# Set timeoutnodetool settimeout read 10000
# Verifynodetool gettimeout readWhen to Use
Section titled “When to Use”During Performance Degradation
Section titled “During Performance Degradation”Temporarily increase timeouts while investigating issues:
# Increase read timeout during slow disk performancenodetool settimeout read 15000
# Increase range timeout for large scansnodetool settimeout range 60000
# After issue resolved, restore defaultsnodetool settimeout read 5000nodetool settimeout range 10000For Known Slow Operations
Section titled “For Known Slow Operations”Accommodate queries with predictably longer execution:
# Large token range scansnodetool settimeout range 30000
# Complex read operationsnodetool settimeout read 10000Troubleshooting Timeout Errors
Section titled “Troubleshooting Timeout Errors”When timeout errors occur but operations should succeed:
# Check current timeoutnodetool gettimeout read
# Increase temporarilynodetool settimeout read 20000
# Test operationcqlsh -e "SELECT * FROM large_table LIMIT 1000;"
# Monitor and adjustCounter-Heavy Workloads
Section titled “Counter-Heavy Workloads”Adjust counter write timeout for busy counter tables:
nodetool settimeout counterwrite 10000Impact Assessment
Section titled “Impact Assessment”Increasing Timeouts
Section titled “Increasing Timeouts”| Effect | Impact |
|---|---|
| Fewer timeout errors | Operations wait longer |
| Resource usage | Connections held longer |
| Error detection | Delayed failure detection |
| Client experience | Longer wait for failures |
Decreasing Timeouts
Section titled “Decreasing Timeouts”| Effect | Impact |
|---|---|
| More timeout errors | Operations fail faster |
| Resource release | Connections freed sooner |
| Error detection | Faster failure detection |
| Client experience | Quicker error responses |
Timeout Considerations
Increasing timeouts masks underlying performance issues. Use temporary increases for emergency response, but investigate and fix root causes.
Workflow: Emergency Timeout Adjustment
Section titled “Workflow: Emergency Timeout Adjustment”#!/bin/bashecho "=== Emergency Timeout Adjustment ==="echo ""
# 1. Record current valuesecho "1. Current timeout values:"for type in read write range; do nodetool gettimeout $typedone
# 2. Save to restore laterecho ""echo "2. Saving current values..."read_timeout=$(nodetool gettimeout read 2>/dev/null | grep -oE "[0-9]+" | head -1)write_timeout=$(nodetool gettimeout write 2>/dev/null | grep -oE "[0-9]+" | head -1)range_timeout=$(nodetool gettimeout range 2>/dev/null | grep -oE "[0-9]+" | head -1)
echo " read=$read_timeout write=$write_timeout range=$range_timeout"
# 3. Apply emergency values (2x default)echo ""echo "3. Applying emergency timeout values..."nodetool settimeout read 10000nodetool settimeout write 4000nodetool settimeout range 20000
echo ""echo "4. New values:"for type in read write range; do nodetool gettimeout $typedone
# 4. Create restore scriptecho ""echo "5. Created restore script: /tmp/restore_timeouts.sh"cat > /tmp/restore_timeouts.sh << EOF#!/bin/bashnodetool settimeout read $read_timeoutnodetool settimeout write $write_timeoutnodetool settimeout range $range_timeoutecho "Timeouts restored to original values."EOFchmod +x /tmp/restore_timeouts.sh
echo ""echo "=== Emergency adjustment complete ==="echo "Run '/tmp/restore_timeouts.sh' to restore original values."Cluster-Wide Changes
Section titled “Cluster-Wide Changes”Set on All Nodes
Section titled “Set on All Nodes”#!/bin/bashTIMEOUT_TYPE="$1"TIMEOUT_VALUE="$2"
if [ -z "$TIMEOUT_TYPE" ] || [ -z "$TIMEOUT_VALUE" ]; then echo "Usage: $0 <timeout_type> <timeout_value_ms>" exit 1fi
echo "Setting $TIMEOUT_TYPE timeout to ${TIMEOUT_VALUE}ms cluster-wide..."
# Get list of node IPs from local nodetool statusnodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do echo -n "$node: " ssh "$node" "nodetool settimeout $TIMEOUT_TYPE $TIMEOUT_VALUE" && echo "OK" || echo "FAILED"done
echo ""echo "Verification:"for node in $nodes; do echo -n "$node: " ssh "$node" "nodetool gettimeout $TIMEOUT_TYPE"doneBatch Set Multiple Timeouts
Section titled “Batch Set Multiple Timeouts”#!/bin/bashREAD_TIMEOUT="${1:-5000}"WRITE_TIMEOUT="${2:-2000}"RANGE_TIMEOUT="${3:-10000}"
echo "Setting timeouts: read=$READ_TIMEOUT write=$WRITE_TIMEOUT range=$RANGE_TIMEOUT"
# Get list of node IPs from local nodetool statusnodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do echo "Configuring $node..." ssh "$node" "nodetool settimeout read $READ_TIMEOUT" ssh "$node" "nodetool settimeout write $WRITE_TIMEOUT" ssh "$node" "nodetool settimeout range $RANGE_TIMEOUT"done
echo "Complete."Configuration Persistence
Section titled “Configuration Persistence”Runtime vs Permanent
Section titled “Runtime vs Permanent”| Setting Source | Persistence | Scope |
|---|---|---|
settimeout | Until restart | This node only |
cassandra.yaml | Permanent | All restarts |
Making Changes Permanent
Section titled “Making Changes Permanent”read_request_timeout_in_ms: 10000write_request_timeout_in_ms: 4000range_request_timeout_in_ms: 20000counter_write_request_timeout_in_ms: 10000cas_contention_timeout_in_ms: 2000truncate_request_timeout_in_ms: 60000Troubleshooting
Section titled “Troubleshooting”Timeout Still Occurring
Section titled “Timeout Still Occurring”# Verify the change took effectnodetool gettimeout read
# May need to increase furthernodetool settimeout read 30000
# Or investigate underlying performance issuenodetool proxyhistogramsCommand Fails
Section titled “Command Fails”# Check JMX connectivitynodetool info
# Verify valid timeout type# Valid types: read, write, range, counterwrite, cascontention, truncate, miscClient Still Times Out
Section titled “Client Still Times Out”# Server-side timeouts affect Cassandra's internal timeouts# Client driver timeouts are separate
# Ensure client timeout >= server timeout# Check client driver configurationBest Practices
Section titled “Best Practices”Timeout Setting Guidelines
- Temporary only - Runtime changes should be temporary
- Document changes - Log when and why timeouts changed
- Restore after fix - Return to defaults once issues resolved
- Investigate root cause - Don't use increased timeouts as permanent fix
- Cluster consistency - Set same values on all nodes
- Monitor effect - Track if timeout errors decrease
Timeout Anti-Patterns
- Don't set extremely high values - Masks problems, wastes resources
- Don't leave temporary increases permanent - Update cassandra.yaml if needed
- Don't ignore timeout errors - They indicate performance issues
- Don't set lower than client timeouts - Client times out first
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| gettimeout | View current timeout values |
| proxyhistograms | View latency distributions |
| info | General node information |