Distributed CAP BASE theory

Distributed CAP theory ( source )

A distributed system can satisfy the most consistency (Consistency), availability (Availability) and partitions fault tolerance (Partition tolerance) in two of the three.

For relational databases, updated data can be requested follow-up visits can see, this is a strong consistency.
If you can tolerate some or all of the follow-up visit less, it is a weak consistency.
If after a period of time required to access the updated data, it is the eventual consistency.
CAP says, can not meet this consistency refers to the strong consistency.

  1. CA without P
    distributed environment, the partition is inevitable, so if you give up P, meant to abandon the distributed system

  2. CP without A
    if a distributed system does not require the availability of strong, i.e., allows the system to shut down, or if no response for a long time, can be protected in the CAP CP and discarded in the three A.

  3. AP wihtout C
    to availability and allow partition, you need to give up consistency. Once the network problem occurs, you may lose the links between nodes. In order to ensure high availability, you need to be returned immediately get, each node can only provide services with local data when users visit, and this can lead to inconsistencies global data.

Which is better a little what, no conclusion can only be decided depending on the scene, the right is the best.

For the money this involves not a hint of compromise scenario, C must be guaranteed. Network failure would rather stop the service, which is guaranteed CP, abandon A. For example, a few years ago Alipay cable Waduan event, when the network failure, Alipay availability and data consistency between the selected data consistency, Alipay users feel the system down for a long time, but in fact behind countless engineers to recover data, to ensure the consistency of the number of data.

For other scenes, the more common practice is to select the partition availability and fault tolerance, give strong consistency, the next best thing eventual consistency to ensure data security.

Distributed BASE theory ( source )

Full name: abbreviation Basically Available (basic available), Soft state (soft state), and Eventually consistent (eventual consistency) three phrases
Base theory is the result of the CAP consistency and availability trade-offs, which is derived from the distribution of large Internet style practice summary is based on the CAP theorem gradually evolved. The core idea is:
not only can not do strong consistency (Strong consistency), but each application according to their operational characteristics, appropriate way to make the system reach eventual consistency (Eventual consistency).

  1. Basically Available (available basic)
    What are the basic are available? Suppose the system, there has been unpredictable failures, but still can be used, in terms of the system as compared to normal:
    in response to a loss of time: 0.5 seconds search engine under normal conditions i.e. the results returned to the user, and the available search engines can be substantially in effect one second return results.
    Loss of features: electricity supplier on a website, under normal circumstances, the user can successfully complete every order, but to a big promotion period, in order to protect the stability of shopping system, some consumers may be directed to a page downgrade .
  2. Soft state (soft state)
    What is a soft state? In terms of the atomic, requiring multiple copies of the data nodes are the same, this is a "hard state."
    It refers to a soft state: the system allows the data in an intermediate state, and that the state does not affect the overall availability of the system, i.e. the system allows the presence of multiple copies of the data in the delay data to different nodes.
  3. Eventually consistent (eventual consistency)
    this is better understood Kazakhstan.
    It says the soft state, then the state can not always be soft, there must be a period of time. After this deadline, should ensure that all copies of data consistency. So as to achieve the final data consistency. The time period depends on the network latency, system load, data replication design, among other factors.
    The official argument is little point:
    the system can ensure that no other new update operations, the data eventually will be able to achieve a consistent state, all client data access to the system will eventually be able to obtain the latest value.

Summary
Overall, BASE theory-oriented large-scale high-availability scalable, distributed systems, and traditional ACID transaction is reversed, it is completely different from the model ACID strong consistency, but obtained by sacrifice strong consistency availability and allow a period of time the data is inconsistent.

Guess you like

Origin www.cnblogs.com/cuiyf/p/11571571.html