Coutesy of Robert Morris ------------ Recap Sequential consistency: * all read/write ops follow some total ordering * a read see the result of latest write (i.e. the write ordered before it) + intuitive semantics - require lots of coordination among nodes (long latency operation) implementing sequential consistency: partition state space among servers [diagram] S0 S1 (S0 serializes all ops w.r.t. object A, S1 serializes object B) C0 C1 (possibly w/ cache) Example coordination: synchronous replication, cache invalidation Many relaxed consistency models: Goal: better performance, less coordination Tradeoff: less intuitive semantics (more anomalies) Today: Eventual consistency Same name has several meanings For better performance, * accept a write before being able to serialize it. * reads can return a (possibly) stale value than blocking for the latest value. Anomalies! * write-write conflict * stale read * loss of causality Desired properties: * Eventual convergence of state * Causality perserving Let's build a shared photo gallery gallery consists of many albums, each identified by an aid Each album (aid) contains an ordered list of photos each identified by a pid. Operations: add album, add photo to album, delete photo etc. Traditional approach: one server Server processes requests one at a time Server implicitly chooses order for concurrent requests Why aren't we satisfied with central server? I want to operate on my gallery at the iPhone. I.e. storage replicated in every node. Modify on any node, as well as read. Periodic connectivity to net and other nodes. Straw man 1: merge storage. What if there's a write-write conflict? Add two photos to the same album "at the same time" But we want automatic conflict resolution. Idea: update functions Have update be a function, not a new value. e.g. add pid to album w/ aid. Read current state of storage, decide best change. Function must be deterministic Otherwise nodes will get different answers Challenge: A: add pid1 to album w/ aid B: add pid2 to album w/ aid X syncs w/ A, then B Y syncs w/ B, then A Will X show pid1 in front of pid2, and Y show pid2 in front of pid1? Goal: eventual state convergence Idea: ordered update log Ordered list of updates at each node. Storage state is result of applying updates in order. Syncing == ensure both nodes have same updates in log. How can nodes agree on update order? Update ID: