CASSANDRA Architecture and Data Model 1 — Questions and Answers
Question 1: What is the primary data distribution mechanism in Apache Cassandra?
- Master-slave replication
- Consistent hashing with a token ring (Correct answer)
- Sharding by row key prefix
- Round-robin assignment
Correct answer: Consistent hashing with a token ring
Cassandra uses consistent hashing on a token ring to distribute data evenly across nodes without a central coordinator.
Question 2: Which component in Cassandra is responsible for in-memory writes before they are flushed to disk?
- SSTable
- MemTable (Correct answer)
- CommitLog
- Bloom Filter
Correct answer: MemTable
A MemTable is an in-memory write-back cache that accumulates mutations before being flushed to an immutable SSTable on disk.
Question 3: What does the term 'eventual consistency' mean in the context of Cassandra?
- All nodes are always in sync
- Reads always return the latest write
- All replicas will converge to the same value given no new updates (Correct answer)
- Writes are synchronous across all replicas
Correct answer: All replicas will converge to the same value given no new updates
Eventual consistency guarantees that if no new updates are made, all replicas will eventually return the same value.
Question 4: In Cassandra's data model, what is a 'partition key' used for?
- Sorting rows within a partition
- Determining which node stores the data (Correct answer)
- Defining secondary indexes
- Setting the TTL on a row
Correct answer: Determining which node stores the data
The partition key is hashed to a token that determines which node(s) are responsible for storing that partition.
Question 5: What is the purpose of a Bloom filter in Cassandra?
- Compress SSTables on disk
- Quickly determine if an SSTable may contain a given partition key (Correct answer)
- Enforce row-level security
- Merge overlapping SSTables
Correct answer: Quickly determine if an SSTable may contain a given partition key
A Bloom filter is a probabilistic data structure that lets Cassandra skip reading SSTables that definitely do not contain the requested key.
Question 6: Which architecture model does Apache Cassandra follow?
- Master-slave
- Peer-to-peer (masterless) (Correct answer)
- Primary-secondary with arbiter
- Hub-and-spoke
Correct answer: Peer-to-peer (masterless)
Cassandra uses a fully peer-to-peer masterless architecture where every node can accept reads and writes.
What is the primary data distribution mechanism in Apache Cassandra?