Quorom mechanism

Quorom mechanism, a distributed system is commonly used for data redundancy and ensure consistency of the final voting algorithm , its main mathematical ideas from the pigeonhole principle.

  What is the pigeonhole principle? 
  One simple method is expressed: 
  If n and n + 1 cages pigeons all pigeons in pigeon holes are shut in, then at least one cage having at least two pigeons. 
  Another is: 
  if n cages and kn + 1 pigeons all pigeons in pigeon holes are shut in, then at least one cage, at least k + 1 pigeons. 
  Well, very familiar with it.

  Distributed systems typically support multiple copies, a copy stored on different nodes, the need for multiple copies of read and write operation. Considering the consistency, you can write to update all copies, but just reading a copy of which when read. However, the write load is too heavy, very easy to read, read and write load obvious imbalance. 
  With the number of copies Quorum mechanism, the write operation requires immediate completion of the reduction, increase the number of copies required read successfully read, read and write the balance to some extent, both operating, overall system performance will be improved. For example, there are five copies, allowing a write operation as long as the finished three returns. The rest of the interior by the system slow synchronization is complete. Read operation, you need to read at least three, we can ensure that at least can read the latest data. (Pigeonhole principle)

  This protocol has three key value N, R and W is: 
  N represents the number of copies of the data has. 
  R represents a minimum number of copies is completed read operation needs to be read. 
  W represents a write operation to complete the minimum number of copies needed to be written.

  This strategy only need to keep R + W> N, it will provide a strong consistency guarantees, because the node and the node to be synchronized read data is written overlapping (pigeonhole principle).

  For example: N = 3, W = 2 , R = 2, then the system has three different data copy, when a write operation is necessary to wait at least two copies of the completed write operating system does not return successfully performed a state for a read operation, the system has the same characteristics. Since R + W> N, so that the system can ensure a strong consistency.

R, high efficiency is read; W of high, the write efficiency.

  NWR model is read (write) the copy delay determined by the slowest R (W), sometimes in order to achieve higher performance and smaller delays, R and W may be less than N, then the system can not guarantee that the read operation get the latest data.

  If R + W ≤ N, where the reading and writing operations do not overlap, the system can ensure that the final consistency, and a copy to a consistent time depends on the asynchronous update system implementation, inconsistency period of time are also equivalent to from beginning to update all nodes are asynchronous completion time between updates.

  The following are a few special cases the different settings. 
  When W = 1, R = N, the system has a high requirement for write operations, the read operation will be slower if there are N nodes node fails, then the read operation is not complete. 
  When R = 1, W = N, the system requires high performance read operation, availability, performance but the write operation is low, the system requires a large amount for a read operation, if there are N nodes node fails, then the write operation can not complete. 
  When R = W = N / 2 + 1, the system performance balance is achieved between the reader, taking into account the availability and performance, the system default settings is this Dynamo, i.e. N = 3, W = 2, R = 2 .

  For NWR models, there are conflicting versions of the problem, to this end, Amazon's Dynamo introduces the Vector Clock, this, then talk.

Guess you like

Origin www.cnblogs.com/lishiqi-blog/p/12313533.html