Interview Questions

Get ready for your next interview with our comprehensive question library

Cassandra Interview Questions

Filter by Difficulty

1.

What is the ring architecture in Cassandra?

beginner

Cassandra uses a ring architecture where:

  • All nodes are arranged in a logical ring
  • Each node is responsible for a range of data (token range)
  • Data is distributed using consistent hashing
  • No single point of failure as there's no master node
  • Nodes communicate using gossip protocol
  • Data is replicated to multiple nodes for fault tolerance

Each node knows about every other node in the cluster and can handle any request.

2.

What are tombstones in Cassandra?

beginner

Tombstones are markers that indicate deleted data. Since Cassandra is distributed:

  • Deletes can't remove data immediately from all replicas
  • Tombstones ensure deleted data doesn't reappear during read repair
  • They have a configurable TTL (gc_grace_seconds, default 10 days)
  • Too many tombstones can impact read performance
  • Compaction eventually removes tombstones and associated data
3.

Explain replication in Cassandra.

beginner

Replication provides fault tolerance:

  • Replication Factor (RF): Number of copies of each piece of data
  • Replication Strategy: Determines which nodes get replicas
    • SimpleStrategy: For single datacenter
    • NetworkTopologyStrategy: For multiple datacenters
  • Coordinator Node: Any node can coordinate a request
  • Replica Nodes: Nodes that store copies of the data

Example: RF=3 means each piece of data is stored on 3 different nodes.

4.

What is the difference between a partition key and clustering key?

beginner
  • Partition Key: Determines which node stores the data (distribution)
  • Clustering Key: Determines the sort order within a partition (organization)
CREATE TABLE events (
    user_id UUID,
    event_time TIMESTAMP,
    event_type TEXT,
    data TEXT,
    PRIMARY KEY (user_id, event_time, event_type)
);
  • user_id is the partition key
  • event_time and event_type are clustering keys
  • All events for a user are stored together, sorted by time and type
5.

Explain different data types available in Cassandra.

beginner

Cassandra supports various data types:

Primitive Types:

  • TEXT, VARCHAR: Strings
  • INT, BIGINT, SMALLINT: Integers
  • FLOAT, DOUBLE, DECIMAL: Floating point
  • BOOLEAN: True/false
  • UUID, TIMEUUID: Unique identifiers
  • TIMESTAMP: Date and time
  • BLOB: Binary data

Collection Types:

  • SET<type>: Unordered unique values
  • LIST<type>: Ordered values (duplicates allowed)
  • MAP<key_type, value_type>: Key-value pairs

Advanced Types:

  • User-defined types (UDT)
  • Tuples
  • Counters
6.

Explain the role of the coordinator node.

beginner

Upgrade to Premium to see the answer

Upgrade to Premium
7.

What are the main differences between Cassandra and traditional RDBMS?

beginner

Upgrade to Premium to see the answer

Upgrade to Premium
8.

Explain the CAP theorem and how Cassandra fits into it.

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
9.

Explain partitioning in Cassandra and the role of partition keys.

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
10.

What are the different consistency levels in Cassandra?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
11.

Describe the write path in Cassandra.

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
12.

Explain the read path in Cassandra.

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
13.

What is compaction in Cassandra and why is it important?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
14.

What are the limitations of Cassandra's data model?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
15.

Explain the concept of eventually consistent reads.

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
16.

What is hinted handoff in Cassandra?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
17.

What is the gossip protocol in Cassandra?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
18.

How do you model a one-to-many relationship in Cassandra?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
19.

What is read repair and when does it occur?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
20.

What is the difference between SimpleStrategy and NetworkTopologyStrategy?

intermediate

Upgrade to Premium to see the answer

Upgrade to Premium
Showing 1 to 20 of 35 results

Premium Plan

$10.00 /monthly
  • Access all premium content - interview questions, and other learning resources

  • We regularly update our features and content, to ensure you get the most relevant and updated premium content.

  • 1000 monthly credits

  • Cancel anytime