RFQUORUMLOCAL_QUORUMHinted HandoffRead RepairAnti-Entropy

Replication & Consistency

Cassandra's tunable consistency lets you choose the trade-off between availability and correctness on a per-query basis. Understanding R + W > RF is the key to getting it right.

50 min read9 sections
01

Replication Factor & Strategies

The Replication Factor (RF) determines how many exist in the cluster. RF=3 means every partition is stored on three different nodes. This is the industry standard for production — it survives one node failure while still achieving QUORUM.

📋

The Important Document

You have a critical contract. RF=1 means one copy in one drawer — if that drawer catches fire, it's gone. RF=3 means three copies in three different buildings. Even if one building burns down, you still have two copies. QUORUM means you need to check at least two copies to be sure you have the latest version.

StrategyConfigurationReplica PlacementUse Case
SimpleStrategyRF=3Next N nodes clockwise on ringSingle DC only (dev/test)
NetworkTopologyStrategy{'dc1': 3, 'dc2': 3}RF per DC, rack-aware placementProduction (always)
create-keyspace.cqlsql
-- SimpleStrategy: NEVER use in production
CREATE KEYSPACE dev_keyspace
WITH replication = {
  'class': 'SimpleStrategy',
  'replication_factor': 3
};

-- NetworkTopologyStrategy: ALWAYS use in production
CREATE KEYSPACE prod_keyspace
WITH replication = {
  'class': 'NetworkTopologyStrategy',
  'dc1': 3,    -- 3 replicas in datacenter 1
  'dc2': 3     -- 3 replicas in datacenter 2
};

-- Why NetworkTopologyStrategy even with 1 DC?
-- Because SimpleStrategy ignores rack placement.
-- NTS ensures replicas are on different racks.
CREATE KEYSPACE single_dc_prod
WITH replication = {
  'class': 'NetworkTopologyStrategy',
  'us-east-1': 3
};

Always Use NetworkTopologyStrategy

Even with a single datacenter, use NetworkTopologyStrategy. It respects rack placement (replicas on different racks) and makes future multi-DC expansion seamless. SimpleStrategy places replicas on the next N nodes clockwise regardless of rack — a single rack failure could lose all replicas.

Replication Factor Guidelines

  • RF=3 is the standard for production workloads
  • RF must be ≤ number of nodes in the DC (can't have 3 replicas with 2 nodes)
  • Higher RF = more durability but more storage and write amplification
  • RF=1 is only acceptable for ephemeral/cacheable data
  • Odd RF values work best with QUORUM (RF=3: QUORUM=2, RF=5: QUORUM=3)
1 / 9