apache-zookeeperservice-discoveryeventual-consistencycap-theorem

Is ZooKeeper always consistent in terms of CAP theorem?


Is that correct that ZooKeeper is always CP (in terms of CAP theorem)? Or is there anyway to use it as AP for service discovery needs?


Solution

  • No, you cannot change consistency guarantees in current versions of ZooKeeper like you can in some other systems.

    You can add a local cache to your clients which will make them have read only data if the cluster goes down, but in terms of CAP that is still not A because it needs to be available for updates as well as reads.

    If ZK offers too strong levels of consistency for your service discovery needs, you should try researching other options, e.g. Eureka, Consul or etcd.

    Possibly related reads: