How does synchronous replication differ from asynchronous replication?
Synchronous and asynchronous replication differ in when changes on the primary server (master) count as successfully applied - before or after they're written to the replica.
1. Synchronous replication
The master waits for confirmation from the replica that the data was written.
- The transaction counts as complete only after both sides have it.
- It guarantees full data consistency, the master and replica are always in sync.
- The downside is it's slower, since it has to wait for the replica to respond.
- It's used where data integrity matters most (banking, finance).
2. Asynchronous replication
The master doesn't wait for confirmation from the replica.
- The transaction completes right after being written to the master.
- The replica catches up with a small delay (usually milliseconds to seconds).
- The upside is it's faster, suited to high-traffic systems.
- The downside is that recent changes can be lost if the master fails.
Summary:
Synchronous = safer, but slower. Asynchronous = faster, but with a risk of the copies diverging.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.