Let's consider a common database with distributed clients. Often we tend to think about the "current state" of the database or the "now" state. But, really, in general, there is no commonly agreed on global state that all clients would agree on.
There is no now!
Even for a centralized database running on a single server, there is no consistent current state. Clients will not observe a commonly agreed on database state
"now". The observers are distributed and there is always a delay until an update has reached a client. And this delay is not deterministic. No matter how short, there
is always a delay.
There can be a central consistent view of the state, but not at
distributed clients / "observers". This is equivalent to the Theory of Relativity.
Information travels with a finite speed. Two observers will in general
observe an update at different times.
So, eventual consistency is the only consistency there ever is!
However, all observers of a centralized database can agree on a global history of the database state. If the updates are sent from the central server to the clients in a given order, the whole history of the data up to the time of the last update that has reached a client can be agreed on between all clients that have received the update. All data is old, there is no agreed on now, but the history up until the last update received, can be globally agreed on.
This is one of the reasons why databases should be append-only (called "immutable" by some) and support historic queries. They should remember the history. This is the only thing that can be globally agreed on.
The video: The Value of Values, Rich Hickley
The Special Theory of Relativity for distributed systems
Post a Comment