Synchronous Replication: Guarantees and Costs
What You'll Learn
You'll understand how synchronous replication provides strong data consistency guarantees at the expense of increased write latency.
The Core Idea
In synchronous replication, when a client writes data to a primary node, that write is not acknowledged as successful until all designated replicas have confirmed they've received and stored the data. The primary blocks and waits for each replica to respond before telling the client "your write succeeded."
Think of it like sending a certified letter that requires signatures from multiple recipients before you receive confirmation—you wait at the post office until everyone has signed, ensuring everyone has the same copy before you leave.
The Guarantee: Strong Consistency
Synchronous replication guarantees that:
- All replicas have identical data after each write
- If the primary fails immediately after acknowledging a write, your data is safe on replicas
- There's zero data loss during failover (assuming replicas are healthy)
- Reads from any replica return the same, most recent value
This is the strongest consistency guarantee possible in replicated systems.
The Cost: Increased Latency
Every write now takes as long as:
- Network round-trip to the slowest replica
- Write time on that slowest replica
- Network round-trip back
If you have replicas across geographic regions, a write that might take 5ms locally could balloon to 100ms+ waiting for a distant replica. Your write performance is bounded by your slowest replica.
Additional costs include:
- Reduced availability: If any replica is down, writes may fail or block
- Coordination overhead: Managing synchronous acknowledgments adds complexity
- Limited scalability: More replicas = longer write times
Key Takeaway: Synchronous replication trades write latency and availability for guaranteed consistency and zero data loss—choose it when data integrity is paramount and you can afford the performance cost.