Cassandra architecture and data modeling review
This domain checks whether you can connect ring mechanics to schema choices: how a partition key maps to tokens and replicas, and how consistency levels change availability.
Core rules
- The partition key is hashed to a token; the ring places replicas according to replication factor and strategy.
NetworkTopologyStrategysets RF per datacenter and places replicas across racks.QUORUMisfloor(RF/2)+1;LOCAL_QUORUMapplies that math inside one datacenter.- Writes go to the commit log and memtable; SSTables are immutable and compacted later.
- Model around queries: choose a high-cardinality partition key, use clustering columns for ordering, and denormalize rather than join.
Worked example
Keyspace app has RF 3 in dc1. A write at CL=QUORUM needs two replica acknowledgements, so one node down still succeeds. A read at QUORUM contacts enough replicas to compare timestamps and repair differences. If two replicas are down, QUORUM fails. A write at CL=ALL fails with any one replica down. For a multi-DC keyspace, LOCAL_QUORUM keeps client latency local but does not make remote replicas synchronous.
Traps
- Setting RF higher than the number of nodes in a datacenter.
- Choosing
ALLfor availability orONEwhile assuming immediate strong durability. - Using a low-cardinality partition key such as status, creating hot partitions.
- Querying without the partition key and expecting an efficient CQL query.