Sync, Async, and Semi-Sync Commits
Synchronous, asynchronous, and semi-synchronous commit — durability versus write latency.
Sync vs Async vs Sem-Sync Replication (Commit-type)
SYNCHRONOUS REPLICATION
Leader waits for follower to confirm before saying OK to client.
✓ Data is safe — follower always has a complete copy. ✗ Slow — you wait for network round trip on every write. One slow follower = entire system slow.
ASYNCHRONOUS REPLICATION
Leader says OK to client immediately. Sends to followers in the background.
✓ Super fast — no waiting. Write confirmed in milliseconds. ✗ Risk — if leader crashes before sending to followers, that data is GONE. You told user saved but it was not.
SEMI-SYNCHRONOUS — THE REAL WORLD CHOICE
This means you always have at least one up-to-date copy. If the synchronous follower slows down → promote an async one to sync. Most production systems (MySQL, PostgreSQL) use this by default.
Summary: Fully Sync → safe but slow. Almost nobody does this. Fully Async → fast but can lose data. Risky for critical systems. Semi-Sync → best of both. One safe copy guaranteed. Rest are fast.
One follower is synchronous. The rest are asynchronous.