Sobes.tech
Senior

What is the difference between synchronous and asynchronous replication in Always On?

sobes.tech AI

Answer from AI

In Always On Availability Groups in SQL Server, there are two types of data replication between the primary and secondary replicas: synchronous and asynchronous.

  • Synchronous replication guarantees that a transaction is considered complete only after the data is written to both the primary and secondary replicas. This ensures high data consistency and minimal data loss in case of failure, but increases transaction latency due to waiting for confirmation from the secondary replica.

  • Asynchronous replication does not wait for confirmation from the secondary replica to complete the transaction on the primary. Data is transmitted with a delay, reducing transaction latency and increasing performance, but in case of failure, recent transactions may be lost as they might not have been replicated yet.

The choice between them depends on the requirements for fault tolerance and performance:

  • Synchronous — for critical data and minimal loss.
  • Asynchronous — for geographically distributed systems with high network latency or when performance is more important.