-
Notifications
You must be signed in to change notification settings - Fork 1
Is ZooKeeper CP or AP
Many people have used Zookeeper as coordination service. One day, when somebody asked whether Zookeeper is CP or AP system, I find the answer is surprising. My first reaction is that Zookeeper is not strong consistent since the read from the follow is not guaranteed to get the latest state. Then it must be AP due to that we usually take two out of three based on CAP theorem. But wait, it seems also not always available. When network partition happens, the client connected to minority couldn't perform writing. So the answer is more like that Zookeeper is neither CP nor AP. But we jump to conclusion, let's clarify what CAP really means.
-
Consistency actually means
linearizability
, alsostrong consistency
. Both will be explained below. -
Availability is defined as
every request received by a non-failing node in the system must result in a response
. That meansany
non-failing node should be able handleany
request. So most so-called highly-available systems don't meet this definition. -
Partition Tolerance basically means that
you’re communicating over an asynchronous network that may delay or drop messages
. The internet and all our data centers have this property, so you don’t really have any choice in this matter.
It seems that we need more clear definition of different level of consistency Guarantees to help us communicate and evaluate distributed systems. Luckily, Doug Terry has defined this:
-
Strong consistency
alsolinearizability
. Eventual consistency
Consistent Prefix
Bounded staleness
Monotonic Read
Read my write