In distributed system, to achieve availability, we write data at multiple places. It is possible that server could go down whenever there is an outage so we have to replicate data at multiple geo locations to achieve high availability.
With multiple copies of the same data, We need to write data at multiple places and all these places must be in sync so clients have a consistent view of the data. Recall the definition of consistency from the CAP theorem – Every read receives the most recent write or an error.
Weak consistency
After a write, reads may or may not see it. A best effort approach is taken.
This approach is seen in systems such as memcached. Weak consistency works well in real time use cases such as VoIP, video chat, and realtime multiplayer games. For example, if you are on a phone call and lose reception for a few seconds, when you regain connection you do not hear what was spoken during connection loss.
Eventual consistency
After a write, reads will eventually see it (typically within milliseconds). Data is replicated asynchronously.
This approach is seen in systems such as DNS and email. Eventual consistency works well in highly available systems.
Strong consistency
After a write, reads will see it. Data is replicated synchronously.
This approach is seen in file systems and RDBMSes. Strong consistency works well in systems that need transactions.