Skip to content
We areTOP 1%

What is database replication, and how do synchronous and asynchronous replication differ?

MediumConceptDatabases: Replication & Sharding
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Replication keeps copies of the same data on several nodes for availability, read scaling and durability. In the common leader-follower setup, all writes go to the leader, which streams changes to followers that serve reads.

  • Synchronous: the leader waits for a follower to confirm before acknowledging, so no acknowledged write is lost on failover, but writes are slower and stall if that follower is down.
  • Asynchronous: the leader acknowledges immediately; writes are fast, but followers lag and recent writes can be lost if the leader fails. Many systems keep one synchronous follower and the rest asynchronous.
  • Replication lag causes stale reads; routing a user's reads to the leader shortly after they write provides read-your-writes consistency.
  • Multi-leader and leaderless setups accept writes on several nodes but must resolve conflicts.

More in Databases: Replication & Sharding

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account