2. Data-centric Consistency Models
- Maintains a globally-accessible and
globally-consistent data store.
- Linearizability, sequential consistency, …
3. Client-centric Consistency Models
- Instead of a globally-consistent view,
maintains consistent views for individual
clients.
- Easier to deal with inconsistencies.
- Eventual consistency, monotonic reads, monotonic
writes, read your writes, writes following reads…
[1], [5]
4. Monotonic reads (MR)
- If a client reads a data entry X, any successive
read of X by the same client returns the same
value or a more recent value.
5. Monotonic WRITES (MW)
- If a client first performs Write1 then Write2,
Write1 is ordered and executed before Write2
on all copies of the data.
6. Writes Following Reads (WFR)
- The client makes a write operation: Write1. Then, it eventually
observes result of Write1 with a ReadX, which is not necessarily
the successive operation of Write1. After ReadX, the client
makes a new write: Write2.
- On all copies of the entry, Write1 is ordered and executed before Write2.
- Happens-before relationship …
7. Read Your Writes (RYW)
- The effect of a write operation by a client on a
data entry X will always be seen by a
successive read operation on X by the same
client.
8. Session Guarantees for Weakly ConsistentReplicated Data [1]
- Defines MR, MW, WFR and RYW guarantees using sessions.
- A client connects to the system and operates within the
boundaries of a session.
- It can talk to a single server or a set of servers, and it can
behave like a server.
- Consistency guarantees are either ensured by the session
manager in the client during the session, or the client learns
that the guarantees cannot be continued, which means that
the session has ended.
10. Highly Available Transactions: Virtues andLimitations [2]
- In the presence of arbitrary, indefinitely-long network
partitions …
- High availability: If a client can contact to a non-failing server,
it eventually receives a response.
- Sticky availability: If a client’s transactions is executed against
a copy of the database that reflects all of its prior operations,
the client eventually receives a response.
- Any guarantee achievable in a highly-available system is also
achievable in a sticky-available system, but not vice-versa.
12. What does it mean?
- You can get linearizability and sequential consistency in
a CP system.
- You can get MR, MW, WFR in an AP system.
- If you have sticky sessions, you can get RYW in an AP
system. Otherwise, you need a CP system for it.
- MR + MW + RYW = PRAM consistency
- PRAM + WFR = Causal consistency
13. How does it work?
- RYW against MR, MW and WFR
- Delaying visibility of writes in MR, MW and WFR [2], [4]
14. How TO map these models to hazelcast?
- In a Hazelcast cluster:
- Each partition has a single owner and possibly
multiple backups.
- All operations are executed on the partition owner.
- Partition operations are linearizable in a stable
Hazelcast cluster.
15. DETECTING INCONSISTENCY CASES IN HAzELCAST
- Can we detect if there is a possibility of data inconsistency on
failures?
- A hypothetical ConsistencyLostListener implementation
- For the following examples, a single partition with 2 replicas is
considered. Additionally, lets assume partition operations
return partition version in responses and our proxy classes can
track them.
20. EXAMPLE #5: MW is lost. We need a Dirty flag.Same for WFR
21. RECAP
- Linearizability and sequential consistency is achievable in CP
systems.
- Hazelcast already provides linearizability on partition level in a stable
cluster (e.g., no network partitioning or partition owner crash).
- In AP systems, causal consistency is achievable with sticky
sessions.
- Hazelcast proxies already are already as they talk to partition owners.
- Hazelcast proxies can detect the possibility of inconsistency
situations.
- On partition owner failure, they can check if they continue the current
session or not.
22. REFERENCES
[1] Terry, Douglas B., et al. "Session guarantees for weakly consistent replicated data." Parallel and Distributed
Information Systems, 1994., Proceedings of the Third International Conference on. IEEE, 1994.
[2] Bailis, Peter, et al. "Highly available transactions: Virtues and limitations." Proceedings of the VLDB Endowment 7.3
(2013): 181-192.
[3] https://aphyr.com/posts/313-strong-consistency-models
[4] http://www.bailis.org/blog/stickiness-and-client-server-session-guarantees/
[5] http://www.allthingsdistributed.com/2008/12/eventually_consistent.html