🏡 Back Home
🔎 Search
Replication
Replication
Primary-replica replication
The primary serves reads and writes, replicating writes to one or more replicas, which serve only reads. Replicas can also replicate to additional replicas in a tree-like fashion. If the primary goes offline, the system can continue to operate in read-only mode until a replica is promoted to a primary or a new primary is provisioned.
Disadvantage(s):
- Additional logic is needed to promote a replica to a primary.
Primary-primary replication
Both primaries serve reads and writes and coordinate with each other on writes. If either primary goes down, the system can continue to operate with both reads and writes.
Disadvantage(s):
- You'll need a load balancer or you'll need to make changes to your application logic to determine where to write.
- Most primary-primary systems are either loosely consistent (violating ACID) or have increased write latency due to synchronization.
- Conflict resolution comes more into play as more write nodes are added and as latency increases.
Disadvantage(s): replication
- There is a potential for loss of data if the primary fails before any newly written data can be replicated to other nodes.
- Writes are replayed to the read replicas. If there are a lot of writes, the read replicas can get bogged down with replaying writes and can't do as many reads.
- The more read replicas, the more you have to replicate, which leads to greater replication lag.
References