Eventually Consistent - Revisited

Consistency is one of the fundamental issues of distributed systems. When we look at traditional database systems they enforce strong consistency which means that after an update completes any subsequent access will see that update. But in a distributed system some things might go wrong - network partitions may occur, servers may crash and not respond.

The CAP Theorem

The CAP theorem states that of three properties of shared-data systems - Consistency, Availability, and tolerance to network Partitions - only two can be achieved at any given time. In a distributed system where network failures can occur, one has to choose between consistency and availability.

For Amazon’s requirements, being available is critical. The core principle is that the system should continue to function in the presence of failures. This means accepting some inconsistency in order to achieve availability.

Eventually Consistent

Eventually consistent systems provide no guarantees as to when all replicas will become consistent. In Amazon’s services, we often see this pattern:

“The storage system guarantees that if no new updates are made to the object, eventually all accesses will return the last updated value.”

This approach allows us to build highly available systems that can continue to serve customers even when network partitions occur or when individual servers fail.

Practical Implications

When designing systems with eventual consistency, we need to consider:

  1. Read-your-writes consistency - Users should see their own writes immediately
  2. Session consistency - Within a session, reads should be consistent
  3. Monotonic read consistency - Subsequent reads should not return values older than previous reads

These different consistency models allow us to provide the right guarantees for different use cases while maintaining high availability.

Conclusion

The trade-offs between consistency and availability are fundamental to distributed systems design. By understanding these trade-offs and choosing the right consistency model for each use case, we can build systems that provide excellent user experiences while remaining highly available and scalable.