In distributed system, redundant data is the means of guaranteeing reliability, so the consistency maintenance of redundant data is very important. In general, a write operation must update all redundant data to be called a successful end. For example, a data on 5 devices have redundancy, because do not know the reading data will fall on which device, then a write operation, must be 5 devices are updated to complete, write operations to return.
For systems with frequent write operations, the bottleneck of this operation is very large. The quorum algorithm allows the write operation to return as soon as it finishes writing 3 units. The rest is done in slow synchronization within the system. Read operations, you need to read at least 3, to ensure that at least one can read the latest data.
Quorum's read-write minimum number of votes can be used as an adjustable parameter for the system in terms of read and write performance. The larger the number of votes, the larger the number of readers, the smaller the VR, the more expensive the system writes. Conversely, the cost of writing is small.
Quorom mechanism is a kind of voting algorithm commonly used in distributed system to ensure data redundancy and eventual consistency, and its main mathematical idea comes from pigeon nest principle.
In distributed storage systems with redundant data, redundant data Objects store multiple copies between different machines. But at the same time multiple copies of a data object can only be used for reading or for writing.
The algorithm can guarantee that multiple copies of the same data object will not be read and written by more than two Access objects.
The algorithm is derived from [Gifford, 1979][3][1]. Each copy of the data in the distributed system is given a vote. Each operation must be given a minimum number of votes (Vr) or minimum number of votes (Vw) to read or write. If a system has a V-ticket (meaning a data object has a v redundant copy), then this minimum read-write ticket must satisfy:
- Vr + Vw > V
- Vw > V/2
The first rule guarantees that a data is not read and written at the same time. When a write request comes in, it must obtain a license for the VW redundant copy. The remaining number is V-VW not enough VR, so no more reading requests come over. Similarly, when a read request has been licensed for a VR redundant copy, the write request is not licensed.
The second rule guarantees the serialization of data modification. A redundant copy of a piece of data cannot be modified by two write requests at the same time.
This article was transferred from: http://www.cnblogs.com/netfocus/p/3622184.html
About the NRW algorithm (quorum algorithm)