What is Apache Cassandra and what problems does it solve?
Learn what Apache Cassandra is, how its masterless distributed architecture works, the problems it solves, and why it powers write-heavy, always-on apps.
Expected Interview Answer
Apache Cassandra is a distributed, wide-column NoSQL database designed for massive scale and high availability, with no single point of failure. It solves the problem of storing huge volumes of write-heavy data across many commodity servers while staying online even when nodes fail.
Cassandra uses a masterless, peer-to-peer ring architecture where every node is equal, and data is partitioned and replicated across nodes using consistent hashing. It offers tunable consistency, so you can trade latency against how strongly reads and writes agree. This lets it scale linearly by simply adding nodes, span multiple data centers, and keep serving requests during outages — problems that traditional single-master relational databases struggle with.
- No single point of failure
- Linear horizontal scalability
- Extremely fast writes
- Multi-data-center replication
- Tunable consistency levels
- High availability during node failures
AI Mentor Explanation
Think of a global cricket tournament where scoring is not trusted to one central scorer who could fall ill and halt the match. Instead every stadium keeps its own synchronized scorebook and they gossip updates to each other. If one venue's scorer leaves, the game continues because others hold the same record. Cassandra works this way: every node keeps replicated data and no master exists, so play never stops when one node goes down.
Step-by-Step Explanation
Step 1
Identify the scaling need
You have write-heavy workloads and data volumes too large for a single relational server to handle.
Step 2
Choose a distributed model
Cassandra partitions data across a ring of equal nodes using consistent hashing on a partition key.
Step 3
Replicate for safety
Each partition is copied to a configurable number of nodes (the replication factor) across racks and data centers.
Step 4
Tune consistency
Pick per-query consistency levels (ONE, QUORUM, ALL) to balance latency against how many replicas must agree.
Step 5
Scale out
Add commodity nodes to grow capacity and throughput linearly, with no downtime and no master to overload.
What Interviewer Expects
- Understanding of masterless peer-to-peer architecture
- Knowledge of partitioning and replication
- Awareness of tunable consistency and CAP trade-offs
- Which workloads suit Cassandra (write-heavy, always-on)
- A concrete real-world use case
Common Mistakes
- Calling Cassandra a relational database with SQL joins
- Assuming it has a single master node
- Ignoring that data model is query-driven, not normalization-driven
- Expecting strong consistency by default
Best Answer (HR Friendly)
“Apache Cassandra is a database built to store enormous amounts of data across many servers at once. It keeps copies of everything on multiple machines, so it stays fast and online even if some servers fail, which makes it great for large, always-on applications.”
Code Example
CREATE KEYSPACE store
WITH replication = {
'class': 'NetworkTopologyStrategy',
'datacenter1': 3
};
CREATE TABLE store.users (
user_id UUID PRIMARY KEY,
name TEXT,
email TEXT
);Follow-up Questions
- What is tunable consistency in Cassandra?
- How does Cassandra partition and replicate data?
- What is the gossip protocol?
- When should you NOT use Cassandra?
- What is a partition key versus a clustering key?
MCQ Practice
1. What architecture does Cassandra use?
Cassandra uses a masterless peer-to-peer ring where every node is equal, eliminating a single point of failure.
2. Which workload is Cassandra best suited for?
Cassandra excels at high-volume, write-heavy workloads that require high availability and horizontal scale.
3. How does Cassandra achieve high availability?
Each partition is replicated to several nodes, so the cluster keeps serving requests even when nodes fail.
Flash Cards
What type of database is Cassandra? — A distributed, wide-column NoSQL database built for scale and high availability.
What is Cassandra's key architectural trait? — Masterless peer-to-peer ring — no single point of failure.
What is a replication factor? — The number of nodes on which each partition of data is copied.
Cassandra's biggest strength? — Extremely fast writes and linear horizontal scalability across data centers.