DEV Community

K.S
K.S

Posted on

Various Consistencies in Distributed Systems

Introduction

The word "consistency" has many meanings in computer science. In this article, we will explain the various consistency aspects of distributed system replication in a clear and straightforward manner.

Serializability

State machine replication with linearizability sorts transactions into a sequence, and that sequence is guaranteed for all replicas. This is completely independent of real-world time.

Linearizability causes the problems shown in the following figure.

Image description

Linearizability only guarantees the update order between replicas, as shown in the figure above, and there is no way to know when that information will be transmitted to other replicas. So, it is possible to read the latest value only at the replica where the latest write was performed, but it is not guaranteed that the latest value can be read at the other replicas.

Linearizability

The difference between linearizability and serializability is always the ability to read the latest value at any replica. Linearizability allows any replica to read the latest value.

Image description

The following words are synonymous with linearizability.

  1. Atomic consistency
  2. Strong consistency
  3. Immediate Consistency
  4. External Consistency

How do we achieve linearization?

Linearizability wants to make the data look like one. To do so, simply lock the whole thing when updating. Therefore, guaranteeing linearizability sacrifices availability.

Eventual Consistency

Eventual consistency means that if you stop writing to the database and wait for some unspecified length of time, then eventually all read requests will return the same value. This means that it is not known when updates to the database will stop, but it is guaranteed that identical values will eventually be read from all replicas. This is a very weak guarantee and says nothing about when the convergence will occur.

Top comments (0)