Eventual Consistency — Database

--

Photo by Jandira Sonnendeck on Unsplash

ACID vs BASE

Relational databases that supports ‘strong consistency ‘ provides ACID guarantees.

  • Atomicity : if transactions failed at any point, the entire operation roll back
  • Consistency : the database remains structurally sound with every transaction
  • Isolation : each transaction is independent of any other transaction
  • Durability : all transaction results are permanently preserved

For this reason, ACID-compliant databases are generally slow, difficult to scale, and expensive to run and maintain.

Non-Relational Databases like NoSQL databases provide BASE guarantees. A BASE enable availability and relaxes the stringent consistency.

  • Basic Availability : Data is available most of the time, even during partial system failure.
  • Soft State : replicas are not consistent all the time.
  • Eventual Consistency : data will become consistent at some point in time, with no guarantee when.

As such, NoSQL databases sacrifice a degree of consistency in order to increase availability. Rather than providing strong consistency, they provide eventual consistency. This means that a datastore that provides BASE guarantees can occasionally fail to return the result of the latest WRITE.

Resources

  1. https://cloud.google.com/datastore/docs/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore

--

--