What is the difference between synchronous and asynchronous replication?

Why Interviewers Ask This

This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex System Design topics. It also reveals how well you can explain technical ideas to non-experts.

Answer

Synchronous replication: the primary node waits for at least one replica to acknowledge that it has received and written the data before confirming the write to the client. The client doesn't receive a success response until the data is on multiple nodes. Pros: zero data loss — if the primary fails after acknowledging a write, at least one replica has the data; strong consistency. Cons: higher write latency — must wait for network round-trip to replica + disk write on replica; if the replica is slow or the network is congested, all writes slow down; if the replica crashes, writes may stall (must wait for timeout). Asynchronous replication: the primary acknowledges the write immediately after writing locally, then replicates to replicas in the background. The client gets a faster response. Pros: lower write latency (client waits only for local disk write); primary performance not affected by slow replicas. Cons: potential data loss — if the primary crashes after acknowledging but before replicating, the unconfirmed writes are lost. Replication lag — replicas may be behind the primary. Semi-synchronous replication: MySQL default — at least one replica must acknowledge before the primary commits. Compromise: less data loss risk than async, less latency than fully sync. Choosing: financial systems needing zero data loss → sync; high-throughput systems tolerating small data loss window → async; most production systems → semi-sync or sync with one fast replica.

Pro Tip

If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.