Database Reference
In-Depth Information
Immediate consistency
When we write a piece of data to a database, it is our hope that that data is immediately
available to any other process that may wish to read it. From another point of view, when
we read some data from a database, we would like to be guaranteed that the data we re-
trieve is the most recently updated version. This guarantee is called
immediate consisten-
cy
, and it's a property of most common single-master databases like MySQL and Post-
greSQL.
Distributed systems like Cassandra typically do not provide an immediate consistency
guarantee. Instead, developers must be willing to accept
eventual consistency
, which
means when data is updated, the system will reflect that update
at some point in the future
.
Developers are willing to give up immediate consistency precisely because it is a direct
tradeoff with high availability.
In the case of Cassandra, that tradeoff is made explicit through
tunable consistency
. Each
time you design a write or read path for data, you have the option of immediate consistency
with less resilient availability, or eventual consistency with extremely resilient availability.
We'll cover consistency tuning in great detail in
Chapter 10
,
How Cassandra Distributes
Data
.