Sync vs async replication

Sync replication confirms a write only after a follower has it. Async replication confirms at once and copies the write later. When the primary fails for 1 s, async loses 50 confirmed writes and sync loses none, but each sync write waits about 100 ms more.

Play the level

Copies and the write quorumDrag or use arrow keys to change the write quorum

Quorum 2 of 3 · commit 9.0 ms

Read and write quorumsLeft and right arrows change R. Tap to change W.

W 3 + R 3 of 5 · every read sees the last write

Case 1

Followers apply writes after 100 ms. At 0:40 the primary fails for 1 s. No confirmed write may be lost, and write p99 must stay under 250 ms.

Case 1
Measure Goal Sync replication Async replication
Lost writes none 0 Pass 50 Fail
Availability (Reads) at least 100% 100% Pass 100% Pass
Availability (Writes) at least 98% 98.3% Pass 100% Pass
p99 latency (Writes) under 250 ms 105 ms Pass 4.7 ms Pass
CPU use under 80% 20.3% Pass 20.3% Pass
Monthly cost 24 USD/mo 24 USD/mo
Error rate 1.7% 0%
SQLSQLUsersUsersPostgres1 vCPU · 2 GB × 3
SQLSQLUsersUsersPostgres1 vCPU · 2 GB × 3
Sync replication: meets the goals
SQLSQLUsersUsersPostgres1 vCPU · 2 GB × 3
SQLSQLUsersUsersPostgres1 vCPU · 2 GB × 3
Async replication: misses a goal