Course contentsShow
← System Design
Lesson 205 of 1,9196. Database Scaling: Read ReplicasFree lesson

Semi-Synchronous Replication

A hybrid approach where at least one replica must acknowledge writes, balancing consistency and performance.

Semi-Synchronous Replication

What you'll learn: How semi-synchronous replication balances the safety of synchronous replication with the speed of asynchronous replication by requiring at least one replica to confirm writes.


The Hybrid Approach

Remember how synchronous replication waits for all replicas to confirm writes (slow but safe), while asynchronous replication doesn't wait for any confirmations (fast but risky)? Semi-synchronous replication sits right in the middle—it requires at least one replica to acknowledge the write before confirming success to the client.

Think of it like sending an important package: With synchronous, you wait until every recipient signs for it. With asynchronous, you just drop it in the mail and hope. With semi-synchronous, you wait for just one person to confirm they received it—you get some safety without waiting forever.

How It Works

When the primary database receives a write:

  1. The primary writes to its own disk
  2. The primary sends the change to all replicas
  3. The primary waits for at least one replica to acknowledge writing the data
  4. Once one replica confirms, the primary returns success to the client
  5. Other replicas continue replicating asynchronously

Why Use It?

This approach prevents total data loss if the primary crashes immediately after a write—you know at least one replica has the data. But you don't suffer the latency penalty of waiting for all replicas. It's a practical compromise for many production systems.

You still get faster writes than full synchronous replication, while protecting against the "oops, nothing was written to replicas yet" scenario of pure asynchronous replication.

Key Takeaway: Semi-synchronous replication requires at least one replica to acknowledge writes, providing a middle ground between synchronous safety and asynchronous speed—one confirmed copy is often enough protection.