Choosing a Replication Mode
What you'll learn: How to select the right replication strategy by weighing consistency needs against latency and availability constraints.
You've seen synchronous, asynchronous, semi-synchronous, and quorum-based replication—but when should you use each? The choice depends on answering two critical questions: How important is strong consistency? and How much latency can you tolerate?
The Decision Framework
Start with consistency requirements:
- Strict consistency needed (financial transactions, inventory): Lean toward synchronous or quorum-based replication. You can't afford showing users stale data or losing writes.
- Eventual consistency acceptable (social feeds, analytics): Asynchronous replication works beautifully—prioritize speed and availability over immediate consistency.
- Somewhere in between (user profiles, notifications): Semi-synchronous offers a middle ground.
Then consider latency tolerance:
- Synchronous replication adds network round-trip time to every write. If your replicas span continents, that's hundreds of milliseconds per operation.
- Asynchronous replication decouples write acknowledgment from replication—writes complete fast, but you risk replication lag during reads.
Finally, evaluate failure scenarios:
- Can you afford losing recent writes during a primary failure? If not, synchronous or quorum-based replication prevents data loss.
- Is availability more critical than perfect consistency during network partitions? Async keeps accepting writes even when replicas are unreachable.
Example Decision
An e-commerce inventory system might use quorum-based replication (W=2, R=2) to ensure stock counts stay accurate across regions while tolerating some latency. A read-heavy news site might use asynchronous replication with monotonic reads to scale reads massively while accepting brief staleness.
Key Takeaway: Choose synchronous/quorum when correctness trumps speed; choose asynchronous when availability and low latency matter more than immediate consistency—there's no universal "best" mode, only the right tradeoff for your specific requirements.