System Design - Replication

The goal of replication is to provide high available and reliable services by store the same copy of data in a few of servers. However, it is always a challenge to maintain consistency of the data.

Primary - Backup replication

Nominate one server as primary, and the others as backup. All client operations goes to primary, and only one primary should be kept at a time. When primary receives request, it sends operation to backup and waits for acknowledgment. Backup applies operation and acknowledge to primary, primary perform operations and acknowledges to the clients.

Q: How to decide who is primary, who is backup?

A view server decides who is primary and who is backup. Clients and servers depends on view server.

P-B

VMware Fault Tolerane (VM-FT)

  1. Replication of the whole virtual machine
  2. Transparent to applications and clients.
  3. High availability for any existing software

VM-FT

Log-Based VM replication

  1. Making the backup an exact replica of primary Primary log results of input events, and send log entries to backup

  2. Making the system behave like a single server FT Protocol: primary logs each operation, delays any output until backup acknowledges it.

  3. Avoiding two primaries (Split Brain). Primary and backup each run UDP heartbeats. Before backup or finding new backup/primary, execute an atomic test and set on a variable in shared storage.

Log-VM

Written on May 20, 2021