04
When to pick what — deeper context
Strong consistency — the intuitive default
Strong consistency means the system behaves as if there's a single copy of the data. This is what developers expect from a single-node database. In distributed systems, achieving this requires synchronous replication: every write waits for a majority of replicas to acknowledge before returning. Google Spanner achieves this globally using TrueTime (GPS + atomic clocks) for bounded clock skew.
Eventual consistency — faster than you think
"Eventual" sounds scary, but in practice convergence happens in milliseconds for well-tuned systems. The real risk is conflict resolution: when two replicas accept conflicting writes, you need a merge strategy (last-writer-wins, CRDTs, application-level resolution). DynamoDB uses LWW by default; Riak offered CRDTs.
Causal consistency — the Goldilocks zone
Causal consistency is the strongest model achievable without coordination in a partition-tolerant system (CALM theorem). It preserves "happens-before" relationships while allowing concurrent operations to be seen in different orders by different nodes. This maps perfectly to chat: "I asked a question, you answered it" — the answer must come after the question, but unrelated messages can reorder freely.
Read-your-writes — the UX requirement
This isn't a formal consistency model but a session guarantee that matters enormously for user experience. Implementation options: (1) route reads to the leader/same replica that handled the write, (2) include a version token in the write response and wait for the replica to catch up before reading, (3) read from cache that's updated on write.
Linearizability vs serializability
These are often confused. Serializability is a transaction isolation level — transactions appear to execute one at a time. Linearizability is about individual operations appearing atomic and real-time ordered. Spanner provides both ("strict serializability"). Most systems provide one or neither.
Tunable consistency — the practical approach
Cassandra and DynamoDB let you choose consistency per query: write to 3 replicas but read from 1 (eventual), or read from 2 out of 3 (quorum = strong). The formula: W + R > N guarantees overlap between write and read sets, giving strong consistency. This per-query tuning lets you optimize hot paths independently.