Introduction

As an alpha sigma Male myself, not a big fan of having multiple leaders. Clearly, such a setup is destined to fail and has many problems with it, as you’ll see in the following article.

  • Anyone can write to any Leaders and they can write anything and we can read from followers to which the writes will be propagated asynchronously.
  • The guy in Europe doesn’t have to write all the way to Africa or APAC.

Configurations where Leaders can pass their writes from one to another.

Topologies:

  1. Circle Topology:
  2. Start topology
  3. All to All Topology

Disadvantages of All-to-All Topology

  1. Network Overhead:

    1. High network traffic due to each node needing to communicate with every other node.
    2. This can lead to significant bandwidth usage and increased latency, especially in large systems.
  2. Complexity:

    1. Managing a large number of connections becomes complex and error-prone.
    2. More sophisticated conflict resolution mechanisms are needed to handle concurrent writes and ensure data consistency.
  3. Scalability Issues:

    1. As the number of nodes increases, the number of connections grows quadratically (N*(N-1)/2).
    2. This limits the scalability of the system and can lead to performance bottlenecks.
  4. Conflict Resolution:

    1. Increased likelihood of conflicts due to simultaneous writes on different nodes.
    2. Requires robust conflict resolution strategies (e.g., Last Write Wins, custom resolution logic) which can be difficult to implement effectively.
  5. Data Consistency Challenges:

    1. Ensuring data consistency across all nodes is challenging due to the asynchronous nature of replication.
    2. Temporary inconsistencies can arise, making it difficult to provide strong consistency guarantees.

Modifying the Replication Log:

Before (in Replication Log)After (add this)
id: 5, key: Jordan, value: sexySeen by: 1, 3, 5 (which replicas has seen this write? Don’t want to duplicate!!)
To keep track of this write as it goes to a specific node, we can add that in our replication log that this write was seen by that specific DB node.
This will ensure that our systems are not sending the writes infinitely in all the directions if we know that this write has been seen by these many DB nodes.

Write Conflicts: