Cassandra
Overview
Architecture
Ring Architecture & Consistent Hashing
Node A (tokens: 0-255)
Node B (tokens: 256-511)
Node C (tokens: 512-767)
→ Data with hash 100 goes to Node AData Model
Key Concepts
Example
Write Path (Why Cassandra is Write-Optimized)
1. Commit Log (Append-Only WAL)
2. MemTable (In-Memory)
3. SSTable Flush
4. Write Flow
Read Path (Optimizations)
Challenge
Optimizations
1. Bloom Filters
2. Partition Summary & Index
3. Key Cache
4. Row Cache
Read Flow
Compaction (Background Maintenance)
Problem
Solution: Compaction Strategies
1. Size-Tiered Compaction (STCS)
2. Leveled Compaction (LCS)
3. Time-Window Compaction (TWCS)
Replication & Consistency
Replication Factor (RF)
Consistency Levels
Level
Reads
Writes
Use Case
Tunable Consistency
Hinted Handoff & Read Repair
Hinted Handoff
Read Repair
Anti-Entropy Repair
Tombstones & Deletions
Problem
Solution
Why 10 Days?
Tombstone Overload
Performance Tuning
Best Practices
1. Data Modeling
2. Hardware
3. Configuration
Common Pitfalls
❌ Using SELECT * with Large Partitions
❌ Allowing Unbounded Growth
❌ Not Running Repairs
❌ Secondary Indexes
Interview Questions
Last updated