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.
VMware Fault Tolerane (VM-FT)
- Replication of the whole virtual machine
- Transparent to applications and clients.
- High availability for any existing software
Log-Based VM replication
-
Making the backup an exact replica of primary Primary log results of input events, and send log entries to backup
-
Making the system behave like a single server FT Protocol: primary logs each operation, delays any output until backup acknowledges it.
-
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.