Hinted Handoff
Hinted handoff handles writes to temporarily unavailable replicas by storing the write locally on the coordinator and replaying it when the replica recovers. This allows writes to succeed at the requested consistency level even when a subset of replicas is unreachable, without requiring the replica to catch up via repair.
How It Works
Section titled “How It Works”The coordinator stores a hint — the mutation plus target endpoint — in a local hints file (durable via the commit log). When the target node is detected as available again, the coordinator delivers accumulated hints in order, throttled to avoid overwhelming the recovering node.
Configuration
Section titled “Configuration”# Enable/disable hinted handoffhinted_handoff_enabled: true
# How long to store hints (default 3 hours)# Hints older than this are droppedmax_hint_window: 3h # 4.1+ (duration format)# max_hint_window_in_ms: 10800000 # Pre-4.1
# Throttle hint delivery to avoid overwhelming recovering nodeshinted_handoff_throttle: 1024KiB # 4.1+ (data size format)# hinted_handoff_throttle_in_kb: 1024 # Pre-4.1
# Maximum delivery threadsmax_hints_delivery_threads: 2
# Hint storage directoryhints_directory: /var/lib/cassandra/hints| Parameter | Pre-4.1 | 4.1+ |
|---|---|---|
| Hint window | max_hint_window_in_ms (milliseconds) | max_hint_window (duration: 3h, 30m) |
| Delivery throttle | hinted_handoff_throttle_in_kb (KB/s) | hinted_handoff_throttle (data size: 1024KiB) |
Hint Window
Section titled “Hint Window”The hint window (max_hint_window in 4.1+, max_hint_window_in_ms in earlier versions) defines how long the coordinator accumulates hints for an unavailable replica. Once the window expires, new writes to that key no longer generate hints.
Node down for 2 hours (window = 3 hours):- Hints accumulated for 2 hours- Node recovers- All hints replayed ✓
Node down for 5 hours (window = 3 hours):- Hints accumulated for first 3 hours- After 3 hours, new writes stop generating hints- Node recovers- Only 3 hours of hints replayed- 2 hours of writes are missing ✗→ Run repair to recover missing dataWhen a node has been down longer than the hint window, hinted handoff alone is insufficient. A full or incremental repair must be run after the node rejoins. See Repair Architecture.
Hints and Consistency Level ANY
Section titled “Hints and Consistency Level ANY”Consistency Level ANY
ANY counts a stored hint as an acknowledgment, meaning a write can succeed even when all target replicas are unreachable.
- The hint is written only to the coordinator's commit log — it is not replicated.
- If the coordinator is permanently lost before hint delivery, the data is lost.
ANYshould not be used for data where durability is required.
Monitoring
Section titled “Monitoring”# Check hint accumulationnodetool tpstats | grep Hint
# View hint filesls -la /var/lib/cassandra/hints/
# Hinted handoff controlnodetool disablehandoff # Disable hinted handoffnodetool enablehandoff # Enable hinted handoffnodetool pausehandoff # Pause hint deliverynodetool resumehandoff # Resume hint deliveryJMX metrics:
org.apache.cassandra.metrics:type=Storage,name=TotalHintsorg.apache.cassandra.metrics:type=HintsService,name=HintsSucceededorg.apache.cassandra.metrics:type=HintsService,name=HintsFailedorg.apache.cassandra.metrics:type=HintsService,name=HintsTimedOutTroubleshooting: Hints Accumulating
Section titled “Troubleshooting: Hints Accumulating”# Check hint backlog sizels -la /var/lib/cassandra/hints/
# Verify target node is reachablenodetool status
# Check hint delivery threads are not saturatednodetool tpstats | grep HintIf hints are not draining after a node recovers, verify that hinted_handoff_enabled is true and that the delivery thread count (max_hints_delivery_threads) is sufficient for the write rate. Large backlogs that persist after node recovery may indicate the target is still unhealthy or the throttle is set too low.
Limitations
Section titled “Limitations”| Limitation | Implication |
|---|---|
| Hints expire | Long outages require repair |
| Hints use disk | Large hint backlog consumes storage |
| Single copy | Coordinator failure loses hints |
| Not for schema | DDL changes do not use hints |
Best Practices
Section titled “Best Practices”| Practice | Rationale |
|---|---|
| Keep enabled | Handles transient failures automatically |
Set max_hint_window to match expected outage duration | Prevents silent data gaps on recovery |
| Monitor hint accumulation | Large backlogs indicate sustained availability problems |
| Do not rely solely on hints | Scheduled repair is still required for complete convergence |
Related Documentation
Section titled “Related Documentation”- Replica Synchronization - Overview of all convergence mechanisms
- Read Repair - Divergence detection during read operations
- Repair Architecture - Merkle trees, repair modes, gc_grace_seconds, and scheduling
- Repair Operations - Operational procedures for repair