Goal

Replication is the main technique in distributed systems to increase availability.

Strategies

Pessimistic Replication

This strategy guarantees that all data is identical to each other.

Optimistic Replication (lazy)

Different replicas can diverge, guaranteeing that eventually, if the system wouldn't receive any updates, they will converge.

Techniques

Single-Master Replication

A single node amongst the replicas is designated as master and others are called replicas(slaves). Master node handles write requests and replicas handle reads.

Master node is responsible of propagating updates to replicas(and executing them locally ofc).

There are two ways of propagating updates:

Synchronous Replication

A master node can reply to a client that an update is completed ONLY if all replicas completed updates on their side. So until the master receives acknowledgments from other nodes it can't tell the client that the request is completed.

This way guarantees that after update was acknowledged by a client, the client will be able to see this update no matter which replica it reads from.

It also provides additional durability, so if the master crashes after acknowledging an update, no reads would be lost.

But the downside is this way makes system slower because master node has to wait until responses have been received from all replicas.

Asynchronous Replication

A master node replies to the client as soon as it updated it's local storage, without waiting responses from replicas.