Data Replication in Distributed Systems

Software Engineering
2 min readJun 21, 2023

--

In distributed systems, different replication techniques are used to ensure data consistency and availability.

Data Replication in Distributed Systems
  1. Single-Leader Replication:
  • In single-leader replication, multiple replicas store copies of the database.
  • One replica is designated as the leader, handling all write requests from clients.
  • Other replicas, known as followers, stay in sync with the leader and serve read requests.
  • When a write request is received, the leader stores the data locally and communicates it to the followers.
  • Clients can read data from any replica, including the leader.

MySQL uses single-leader replication, making it suitable for read-heavy systems but challenging to scale for large volumes of data.

2. Multi-Leader Replication:

  • Multi-leader replication involves having multiple leaders in the system.
  • Each leader has its own set of followers exclusive to it.
  • When a write request is received by a leader, it stores the data locally and communicates it to its followers, including other leaders.
  • All leaders process the write request, ensuring synchronization between datacenters in cross-datacenter systems.
  • Reads can be performed on any replica.
  • Example: Multi-leader replication is commonly used in cross-datacenter database systems.

3. Leaderless Replication:

  • Leaderless replication eliminates the concept of a single leader.
  • Any replica can accept write requests and store the data locally.
  • The write request is then communicated to other replicas for processing.
  • All replicas that receive the write request process it independently.
  • Reads can be performed on any replica without relying on a specific leader.

DynamoDB by AWS implements a leaderless replication mechanism and is known for its high performance.

Key Takeaways:

  • Single-leader replication is more intuitive compared to multi-leader and leaderless replication.
  • Multi-leader and leaderless replications are gaining popularity due to large-scale data centre systems and highly scalable key-value stores.
  • Choosing the appropriate replication technique is crucial for a system’s success, as an incorrect choice can lead to engineering challenges or inadequate performance.

--

--

Software Engineering
Software Engineering

Written by Software Engineering

0 Followers

A Software Engineer's guide for their next opportunity.

No responses yet