Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between peer-to-peer and merge replication with SQL Server?

What's the difference between peer-to-peer replication and merge replication using SQL Server?

like image 547
Guy Avatar asked Sep 16 '09 19:09

Guy


2 Answers

  1. Peer-to-Peer Transactional Replication is typically used to support applications that distribute read operations across a number of server nodes.

Although peer-to-peer replication enables scaling out of read operations, write performance for the topology is like that for a single node, this is because ultimately all inserts, updates, and deletes are propagated to all nodes. If one of the nodes in the system fails, an application layer can redirect the writes for that node to another node, this is not a requirement but does maintain availability if a node fails.

See: Peer-To-Peer Replicaiton

  1. Merge Replication is bi-directional i.e. read and wrtie operations are propogated to and from all nodes. Merge replication often requires the implementation of conflict resolution.

See: How Merge Replication Works

like image 195
John Sansom Avatar answered Sep 18 '22 12:09

John Sansom


The main difference is that for merge replication there is only one publisher and one or more subscribers, but in peer-to-peer replication all nodes are both publishers and subscribers(though original node is highlighted with green arrow).

Secondly peer-to-peer replication is transactional which means it transmits transactionally consistent changes. In contrast, merge replication is trigger based. In the background implementation they also use different agents.

Merge replication has conflict resolution(you can specify conflict resolution priority), peer-to-peer doesn't. During a conflict peer-to-peer generates an alert if conflict resolution is enabled, stops replication while allowing both instances to work independently till the conflict is solved. In production, it is advisable to do schema changes only from the original node.

In peer-to-peer replication all nodes are identical while in merge they can differ. I mean that subscribers can get different data from the publisher.

They both are basically doing the same job - providing scale-out, disaster recovery, and in some cases where updates are rare and locks do not bother that much, also high availability by providing data redundancy. Sometimes, peer-to-peer is related as the replacement for the merge replication.

like image 36
igelr Avatar answered Sep 21 '22 12:09

igelr