Registration discovered the principle of service | -CAP guarantee consistency principle | The timeliness of registration service discovery | capacity | |
---|---|---|---|---|
zookeeper | The cluster is divided into a leader other machines for the follower, and only leader able to write, that service registry, and then synchronize the data to the follower, leader / follower can be read | Ensure CP, namely consistency, when zk hang in a cluster leader, leader of the re-election, during which the entire cluster will be unavailable until the elected leader | Better timeliness, registered or hung up, the general second class will be able to perceive | zk is not suitable for large-scale deployment of the service instance, because the service offline, the need for instant push notification data to all other service instances (consumer), so once the service too big to thousands of the machine, can cause network bandwidth short period of time being used up |
erueka | peer-to-peer, the status of each machine in the cluster are equal, each service can be a Eureka to any instance of service registration and service discovery, a Eureka cluster any instance after receiving a written request, will automatically sync to all other examples of Eureka | Ensure the AP, Eureka has just received a service registration information did not have time to synchronize other instances hung up, other examples can still provide service discovery, but not the latest data, only guarantee eventual consistency | Under the default configuration, service discovery and perceived need ten seconds or even minutes to level | eureka also difficult to support large-scale service instances because each eureka instance must accept all requests |
Why zk timeliness good
zk client can be created on znode watch the object for monitoring znode related events add a sub-node, modify, delete, etc., when an event occurs you will be promptly notified.
And eureka multi-level cache, and so the timing of the polling service stores the updated list, so relatively poor aging