160 likes | 299 Views
CIS 720. Replication. Replica Management. Three Subproblems. Your boss says to you, “Our system is too slow, make it faster.” You decide that replication of servers is the answer. What do you do next? What are the questions that need to be answered? Where to place servers?
E N D
CIS 720 Replication
Three Subproblems • Your boss says to you, “Our system is too slow, make it faster.” • You decide that replication of servers is the answer. What do you do next? What are the questions that need to be answered? • Where to place servers? • Where to place content? • What replication algorithm to use?
Placing Servers • Given a set of N locations, how do you place the K servers? • What are the goals? • What is the metric that is being optimized? • One algorithm, each time you place a server, minimize the average remaining distance to clients. • What is “distance”? • Is “average” the right thing to minimize? What if one client accesses a lot, the other not so much.
One-copy equivalence Conditions to ensure one-copy equivalence: - a read and a write operation cannot happen at the same time - two write operations cannot happen at the same time
Quorum based protocols • Each copy p has a weight weight(p) • For each data item d, - read quorum r(d) - write quorum w(d) • Read quorum = any set of copies whose combined weight is >= r(d) • Write quorum = any set of copies whose combined weight is >= w(d)
A B C 3 2 2 Read quorum: 3 { (A), (B, C), (A, B), (A, C), (A,B, C) } Write quorum: 4 { (A, B), (A, C), (B, C), (A,B, C)}
To ensure one-copy equivalence, we use the following rules: r(d) + w(d) > total(d) w(d) > total(d)/2 total(d) = sum of the weights of all the replicas
A B C 3 2 2 Read quorum: 3 Write quorum: 4
A timestamp for each variable is maintained at each replica • To write x, - lock a write quorum - let max be the largest timestamps in the quorum for x - write x with timestamp max + 1 to the quorum
To read x, - lock a read quorum - read data items from the read quorum - return the value with the largest timestamp
Lock granting rules • Two or more read locks can be granted concurrently on a replica • Two write locks or a read lock and a write lock cannot be granted at the same time.
Avoid deadlocks • Acquire locks in the increasing order of replica ids
Common quorum protocols • Majority consensus: weight(p) = 1; N copies r(d) = N/2 + 1; w(d) = N/2 + 1 • Read one/write all weight(p) = 1 r(d) = 1; w(d) = N • Write one/read all
Fault tolerance • Majority consensus: tolerate up to N/2 failures • Read one/write all writes will be blocked on any failure