CASSANDRA Performance and Tuning 2 — Questions and Answers
Question 1: What does 'hinted handoff' do when a replica node is temporarily down?
- The coordinator waits indefinitely for the down node to recover
- The coordinator stores the write as a hint and replays it to the node when it recovers (Correct answer)
- The write is permanently rejected
- Another replica is permanently promoted to own that token range
Correct answer: The coordinator stores the write as a hint and replays it to the node when it recovers
Hinted handoff lets the coordinator temporarily store missed writes for a down replica and deliver them once that node comes back online, improving write availability.
Question 2: What is 'write amplification' in the context of Cassandra compaction?
- The ratio of reads to writes during compaction
- The multiple of data written to disk relative to the actual data inserted due to compaction rewriting SSTables (Correct answer)
- The number of replicas a write is sent to
- The overhead of writing both MemTable and CommitLog
Correct answer: The multiple of data written to disk relative to the actual data inserted due to compaction rewriting SSTables
Write amplification occurs because compaction must read and rewrite SSTables to merge them, causing significantly more disk I/O than the original writes.
Question 3: What does the 'nodetool tpstats' command display?
- Token placement statistics per node
- Thread pool statistics showing active, pending, and blocked tasks (Correct answer)
- Table-level partition size statistics
- Time-series performance metrics
Correct answer: Thread pool statistics showing active, pending, and blocked tasks
nodetool tpstats shows the state of all Cassandra internal thread pools, helping identify bottlenecks when pending or blocked counts are high.
Question 4: What is 'key cache' in Cassandra and how does it improve performance?
- Caches the most recently executed CQL queries
- Caches partition key to SSTable offset mappings, reducing disk seeks for frequently accessed partitions (Correct answer)
- Caches the entire row for hot partitions
- Caches Bloom filter results to avoid recalculation
Correct answer: Caches partition key to SSTable offset mappings, reducing disk seeks for frequently accessed partitions
The key cache stores the position of a partition key within an SSTable, so Cassandra can skip the index lookup and seek directly to the data on subsequent accesses.
Question 5: What does the 'LOCAL_QUORUM' consistency level ensure in a multi-datacenter Cassandra deployment?
- A quorum of nodes across all data centers must respond
- A quorum of nodes within the local data center must respond (Correct answer)
- Only one node in the local data center must respond
- All nodes in the local data center must respond
Correct answer: A quorum of nodes within the local data center must respond
LOCAL_QUORUM satisfies quorum using only replicas in the same data center as the coordinator, avoiding cross-DC latency while still providing strong consistency locally.
Question 6: What is the impact of too many tombstones in a Cassandra partition?
- Increased write throughput
- Degraded read performance because Cassandra must scan and filter tombstones during reads (Correct answer)
- Faster compaction cycles
- Reduced replication overhead
Correct answer: Degraded read performance because Cassandra must scan and filter tombstones during reads
Reads must traverse tombstones to determine what data is live; a partition with millions of tombstones can cause read timeouts and TombstoneOverwhelmingException.
What does 'hinted handoff' do when a replica node is temporarily down?