What is Cassandra's eventual consistency and how does it handle conflicts?
Answer
Cassandra uses eventual consistency as its default model — all replicas will eventually agree on the same value, but reads might return stale data momentarily. Conflict resolution uses Last Write Wins (LWW): every write is timestamped (in microseconds), and the version with the latest timestamp wins. This means: if two clients write to the same cell simultaneously, the one with the later client timestamp "wins" — the other write is silently discarded. Read repair: when Cassandra reads from multiple replicas and detects inconsistency, it repairs stale replicas in the background (read_repair_chance). Anti-entropy repair: the nodetool repair command compares all replicas and synchronizes them — run regularly in production. Implications: LWW means clock skew between nodes can cause data loss. Using TIMESTAMP in writes allows client-side timestamp control. Cassandra is not suitable for operations requiring strong consistency without configuring QUORUM or ALL consistency levels.
Previous
What is Cassandra's CQL (Cassandra Query Language)?
Next
What is RabbitMQ's topic exchange?