Course contentsShow
← Computer Science
Lesson 2640 of 2,87259. Consensus and ReplicationFree lesson

Synchronous vs. Asynchronous Replication

Comparing synchronous replication (waiting for acknowledgment) with asynchronous replication (fire-and-forget).

Synchronous vs. Asynchronous Replication

What You'll Learn

You'll understand the fundamental trade-off between waiting for replica confirmation (synchronous) versus sending updates without waiting (asynchronous).

The Core Distinction

In synchronous replication, the leader waits for acknowledgment from one or more replicas before confirming a write is complete. The client only receives success after the data is safely stored on multiple nodes.

In asynchronous replication, the leader immediately confirms the write to the client after storing it locally, then sends updates to replicas in the background without waiting for their acknowledgment—a "fire-and-forget" approach.

The Trade-Off

Synchronous replication guarantees consistency: if the leader crashes immediately after confirming a write, at least one replica has the data. However, writes are slower because you wait for network round-trips. If a replica is slow or unreachable, the entire system slows down or becomes unavailable.

Asynchronous replication offers better performance and availability: the leader never waits, so writes are fast and a slow replica doesn't block anything. The downside? If the leader crashes before replicas receive recent writes, that data is lost forever. Replicas lag behind, creating a window of inconsistency.

Real-World Analogy

Think of submitting homework:

  • Synchronous: You hand it to your teacher and wait for them to file it in their cabinet before you leave. Slower, but you know it's safe.
  • Asynchronous: You drop it in the teacher's inbox and immediately leave. Faster, but if the teacher's desk catches fire before they file it, your work is gone.

Hybrid Approaches

Many systems use semi-synchronous replication: wait for just one replica (not all) to acknowledge, balancing durability with performance.

Key Takeaway: Synchronous replication trades write latency for guaranteed durability and consistency, while asynchronous replication sacrifices durability for speed and availability—choose based on whether you can tolerate data loss.