DDIA | Replication | Multi Leader Replication | Multi-Leader Replication Topologies

In previous post, we ;looked into how to handle write conflicts in multi leader replication. This post concludes the multi leader replication with an insight into topologies.

replication topology describes the communication paths along which writes are propagated from one node to another. If you have two leaders, there is only one plausible topology: leader 1 must send all of its writes to leader 2, and vice versa. With more than two leaders, various different topologies are possible.

All-to-all – every leader sends its writes to every other leader.

Circular – each node receives writes from one node and forwards those writes (plus any writes of its own) to one other node.

Star – one designated root node forwards writes to all of the other nodes.

In circular and star topologies, a write may need to pass through several nodes before it reaches all replicas. Therefore, nodes need to forward data changes they receive from other nodes.

To prevent infinite replication loops, each node is given a unique identifier, and in the replication log, each write is tagged with the identifiers of all the nodes it has passed through. So when node receives data tagged with it’s own identifier it igones that data and breaks the cycle.

A problem with circular and star topologies is that if just one node fails, it can interrupt the flow of replication messages between other nodes, causing them to be unable to communicate until the node is fixed.

A problem with all to all topology is that sequence of writes could be broken resulting in faulty data if conflict resolution strategies is not implemented.

Thanks for stopping by! Hope this gives you a brief overview in to different multi leader replication topologies and their problems.. Eager to hear your thoughts and chat, please leave comments below and we can discuss.