Zookeeper from the CAP to the comparison and eureka

Today saw a eureka article comparing zookeeper, zookeeper to meet the CAP CP, eureka meet the AP had little doubt that it carried out some research to write this article.

First, let's look at the definition of CAP

Consistency

  Chinese is called "consistency." You mean, read after write operation, must return the value. For example, a record is v0, the user initiates a write operation to the G1, which is to v1, next, the user will get a read operation v1. This is called consistency.

Availability

   Chinese called the "availability", meaning that as long as the user's request is received, the server must be given a response. Users can choose to G1 or G2 initiate a read operation. No matter which server, as long as the request is received, it must tell the user, in the end it is v0 or v1, or do not meet the availability.

Partition tolerance:

  Chinese called "fault-tolerant partition", most distributed systems are distributed across multiple sub-networks. Each subnetwork is called a zone (partition). Fault-tolerant partition mean, range communication may fail. For example, a server in China, another server in the United States, which is the two areas could not communicate between them.

I.e. a distributed system, only two of them meet, and, in general, are to satisfy the partition fault tolerance.

 

eureka characteristics of AP

Since that meet eureka AP characteristics, does that indicate that eureka is not satisfied with the consistency of a registration center of it, so that as a registration center middleware is certainly not acceptable, so we have to fine under study.

Eureka each node are equal, hang a few nodes will not affect the normal node, the remaining nodes can still provide registration and inquiry services. The Eureka client when registering with the Eureka or if you find a connection fails, it will automatically switch to the other nodes, as long as there is still a Eureka, we can guarantee registration services are available (to ensure availability), but found the information may not be current (not guarantee strong consistency), which describes, eureka strong consistency is not satisfied, but still guarantee eventual consistency, it is possible to draw a conclusion, eureka does not meet the consistency is not only in the same circumstances next, eureka will first ensure the availability, consistency of sync again in a certain extent.

 

zookeeper characteristics of CP

Similarly, we look zookeeper, zookeeper at election time leader, will be out of service until after the success of the elections will provide services again, this time to explain the service is not available, but after the success of the elections, because a master multi-slave structure, zookeeper at this time or a high-availability registry, but the priority of ensuring the consistency of the premise, zookeeper will take into account the availability.

to sum up

So here discussed from AP zk of CP eureka and draw a result, CAP in fact, in a distributed system, which is a priority to ensure that meet two characteristics, rather than simply meet only two of the characteristics in the traditional sense and give up another characteristic.

 

Guess you like

Origin www.cnblogs.com/hszwx/p/11595160.html