ACID vs BASE
ACID: Atomicity, Consistency, Isolation, Durability.
BASE: Basic Availability, Soft-state, Eventual consistency.
ACID | BASE |
---|---|
Strong Consistency | Weak Consistency |
Isolation | Stale data is OK |
Focus on Commit | Availability first |
Nested transactions | Best effort |
Availability? | Approximate answers are OK |
What is Soft-state?
For example, a presence user could post a presence document that says “I’m driving”. Somewhere along that drive, the user goes into a parking garage, losing connection to the network. The user leaves his car and makes it into a movie theater without reconnecting.
In a less-robust system, that user’s presence will be wrong for the next hour or so. A SIP based presence system will notice, after some time, that the user is no longer maintaining the presence document and will fall back to a known safe default, probably “I don’t know anything about this user’s presence right now.”
From here.
[soft state] is information (state) the user put into the system that will go away if the user doesn't maintain it. Stated another way, the information will expire unless it is refreshed.
By contrast, the position of a typical simple light-switch is "hard-state". If you flip it up, it will stay up, possibly forever. It will only change back to down when you (or some other user) explicitly comes back to manipulate it.
What is Eventual consistency?
Eventually all nodes will show the same data, but they may not all show the same data initially. It will only happen if you let the changes propagate without making any more changes.
This may sound like a mad idea, but actually the entire internet is built upon an "eventual consistency database", which is the DNS database.