consistency model

By | May 10, 2021
Share the joy
  •  
  •  
  •  
  •  
  •  
  •  

Strictly Serializable

support transaction, Spanner

Linearizable

Doesn’t support transaction. There is global timer. Things in different machine happens with the global timer.

Sequential consistency

sequential

Above example satisfies sequential consistency. P3, P4, P5 all observe that W(x)1 happens before W(x)3. They are globally making sense. So it is sequential consistent. But considering the time when W(x)3 happens is early than W(x)1, so it is not linearizable consistent.

应用: zookeeper

Causal consistency

by using lamport timestamp

causal_vs_non_causual

In (a), P2 observes that W(x)a should be before W(x)b. value b maybe depends on the value a. a -> b. But P3 observes that W(x)b -> R(x)a. So this doesn’t make sense. So, not causal.

Another example is that Alice asks a question, then Alice tells the answer. But person B observes the answer before the question. So it is not causal.

In (b), P3 observes W(x)b -> W(x)a. P4 observes W(x)a -> W(x)b. But W(x)a, W(x)b happens concurrently, it still makes sense. Causal consistency doesn’t require consistent in global. But (b) is not sequential consistency, because it is not consistent globally.

应用: 朋友圈. 朋友圈的发生顺序要make sense. 要因果一致.

causal_vs_non_causal

Eventual consistency

weakest one.

https://jepsen.io/consistency