Lecture 21: Replication Control

Slides:



Advertisements
Similar presentations
CS 542: Topics in Distributed Systems Diganta Goswami.
Advertisements

Replication. Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures.
CS542: Topics in Distributed Systems Distributed Transactions and Two Phase Commit Protocol.
CIS 720 Concurrency Control. Timestamp-based concurrency control Assign a timestamp ts(T) to each transaction T. Each data item x has two timestamps:
EEC 688/788 Secure and Dependable Computing Lecture 12 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Distributed Systems Fall 2010 Replication Fall 20105DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Transaction Processing Lecture ACID 2 phase commit.
Two phase commit. What we’ve learnt so far Sequential consistency –All nodes agree on a total order of ops on a single object Crash recovery –An operation.
CS 582 / CMPE 481 Distributed Systems
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 19: Paxos All slides © IG.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 18: Replication Control All slides © IG.
Transaction Management WXES 2103 Database. Content What is transaction Transaction properties Transaction management with SQL Transaction log DBMS Transaction.
Distributed Databases
CS162 Section Lecture 10 Slides based from Lecture and
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Replication with View Synchronous Group Communication Steve Ko Computer Sciences and Engineering.
CSE 486/586 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
IM NTU Distributed Information Systems 2004 Replication Management -- 1 Replication Management Yih-Kuen Tsay Dept. of Information Management National Taiwan.
Paxos A Consensus Algorithm for Fault Tolerant Replication.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Replication Steve Ko Computer Sciences and Engineering University at Buffalo.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Commit Algorithms Hamid Al-Hamadi CS 5204 November 17, 2009.
Chap 7: Consistency and Replication
Chapter 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University Building Dependable Distributed Systems.
Chapter 7: Consistency & Replication IV - REPLICATION MANAGEMENT By Jyothsna Natarajan Instructor: Prof. Yanqing Zhang Course: Advanced Operating Systems.
Replication Improves reliability Improves availability ( What good is a reliable system if it is not available?) Replication must be transparent and create.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Replication Steve Ko Computer Sciences and Engineering University at Buffalo.
EEC 688/788 Secure and Dependable Computing Lecture 9 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
CSE 486/586 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
CS 525 Advanced Distributed Systems Spring 2013
Distributed Systems – Paxos
CSE 486/586 Distributed Systems Consistency --- 1
Lecture 17: Leader Election
Two phase commit.
Replication Control II Reading: Chapter 15 (relevant parts)
CS 525 Advanced Distributed Systems Spring 2018
EECS 498 Introduction to Distributed Systems Fall 2017
EECS 498 Introduction to Distributed Systems Fall 2017
Outline Announcements Fault Tolerance.
7.1. CONSISTENCY AND REPLICATION INTRODUCTION
CSE 486/586 Distributed Systems Consistency --- 1
Replication Improves reliability Improves availability
Active replication for fault tolerance
Fault-tolerance techniques RSM, Paxos
Replication and Recovery in Distributed Systems
CS 425 / ECE 428 Distributed Systems Fall 2017 Indranil Gupta (Indy)
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
CSE 486/586 Distributed Systems Concurrency Control --- 3
Distributed Transactions
Atomic Commit and Concurrency Control
EEC 688/788 Secure and Dependable Computing
IS 651: Distributed Systems Final Exam
Causal Consistency and Two-Phase Commit
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
The SMART Way to Migrate Replicated Stateful Services
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Lecture 21: Replication Control
Implementing Consistency -- Paxos
CSE 486/586 Distributed Systems Consistency --- 1
CIS 720 Concurrency Control.
CSE 486/586 Distributed Systems Concurrency Control --- 3
Last Class: Fault Tolerance
Transaction Communication
Presentation transcript:

Lecture 21: Replication Control CS 425 / ECE 428 Distributed Systems Fall 2018 Indranil Gupta (Indy) Lecture 21: Replication Control All slides © IG

Server-side Focus Concurrency Control = how to coordinate multiple concurrent clients executing operations (or transactions) with a server Next: Replication Control = how to handle operations (or transactions) when there are objects are stored at multiple servers, with or without replication 2

Replication: What and Why Replication = An object has identical copies, each maintained by a separate server Copies are called “replicas” Why replication? Fault-tolerance: With k replicas of each object, can tolerate failure of any (k-1) servers in the system Load balancing: Spread read/write operations out over the k replicas => load lowered by a factor of k compared to a single replica Replication => Higher Availability 3

Availability If each server is down a fraction f of the time Server’s failure probability With no replication, availability of object = = Probability that single copy is up = (1 – f) With k replicas, availability of object = Probability that at least one replicas is up = 1 – Probability that all replicas are down = (1 – f k) 4

Nines Availability With no replication, availability of object = With k replicas, availability of object = = (1 – f k) Availability Table f=failure probability No replication k=3 replicas k=5 replicas 0.1 90% 99.9% 99.999% 0.05 95% 99.9875% 6 Nines 0.01 99% 99.9999% 10 Nines 5

What’s the Catch? Challenge is to maintain two properties Replication Transparency A client ought not to be aware of multiple copies of objects existing on the server side Replication Consistency All clients see single consistent copy of data, in spite of replication For transactions, guarantee ACID 6

(replies flow opposite) Replication Transparency Client Front End Replica 1 Replica 2 Replica 3 Front ends provide replication transparency Requests (replies flow opposite) Replicas of an object O 7

Replication Consistency Two ways to forward updates from front-ends (FEs) to replica group Passive Replication: uses a primary replica (master) Active Replication: treats all replicas identically Both approaches use the concept of “Replicated State Machines” Each replica’s code runs the same state machine Multiple copies of the same State Machine begun in the Start state, and receiving the same Inputs in the same order will arrive at the same State having generated the same Outputs. [Schneider 1990] 8

Passive Replication Client Front End Replica 1 Replica 2 Replica 3 Requests (replies flow opposite) Master (elected leader) Master => total ordering of all updates On master failure, run election 9

(replies flow opposite) Active Replication Client Front End Replica 1 Replica 2 Replica 3 Front ends provide replication transparency Requests (replies flow opposite) Multicast inside Replica group 10

Active Replication Using Concepts You’ve Learnt earlier Can use any flavor of multicast ordering, depending on application FIFO ordering Causal ordering Total ordering Hybrid ordering Total or Hybrid (*-Total) ordering + Replicated State machines approach => all replicas reflect the same sequence of updates to the object 11

Active Replication Using Concepts You’ve Learnt earlier (2) What about failures? Use virtual synchrony (i.e., view synchrony) Virtual synchrony with total ordering for multicasts => All replicas see all failures/joins/leaves and all multicasts in the same order Could also use causal (or even FIFO) ordering if application can tolerate it 12

Transactions and Replication One-copy serializability A concurrent execution of transactions in a replicated database is one-copy-serializable if it is equivalent to a serial execution of these transactions over a single logical copy of the database. (Or) The effect of transactions performed by clients on replicated objects should be the same as if they had been performed one at a time on a single set of objects (i.e., 1 replica per object). In a non-replicated system, transactions appear to be performed one at a time in some order. Correctness means serial equivalence of transactions When objects are replicated, transaction systems for correctness need one-copy serializability   13

Next Committing transactions with distributed servers 14

Transactions with Distributed Servers Transaction T write(A,1); write(B,2); … write(Y, 25); write(Z, 26); commit Object A Object B Server 1 Object Y Object Z Server 13 . 15

Transactions With Distributed Servers Transaction T may touch objects that reside on different servers When T tries to commit Need to ensure all these servers commit their updates from T => T will commit Or none of these servers commit => T will abort What problem is this? 16

Transactions With Distributed Servers Transaction T may touch objects that reside on different servers When T tries to commit Need to ensure all these servers commit their updates from T => T will commit Or none of these servers commit => T will abort What problem is this? Consensus! (It’s also called the “Atomic Commit problem”) 17

One-phase Commit Coordinator Server Object A Transaction T write(A,1); write(B,2); … write(Y, 25); write(Z, 26); commit . Object B . Server 13 Special server called “Coordinator” initiates atomic commit Tells other servers to either commit or abort Object Y Object Z 18

One-phase Commit: Issues Server with object has no say in whether transaction commits or aborts If object corrupted, it just cannot commit (while other servers have committed) Server may crash before receiving commit message, with some updates still in memory 19

Two-phase Commit Coordinator Server … Server 1 Server 13 Prepare 20

Two-phase Commit Coordinator Server Server 1 Server 13 Prepare … Server 1 Server 13 Prepare Save updates to disk Respond with “Yes” or “No”

Two-phase Commit Coordinator Server Server 1 Server 13 Prepare … Server 1 Server 13 Prepare Save updates to disk Respond with “Yes” or “No” If any “No” vote or timeout before all (13) votes Abort

Two-phase Commit Coordinator Server Server 1 Server 13 Prepare … Server 1 Server 13 Prepare Save updates to disk Respond with “Yes” or “No” All (13) “Yes” votes received within timeout? Commit

Two-phase Commit Coordinator Server Server 1 Server 13 Prepare … Server 1 Server 13 Prepare Save updates to disk Respond with “Yes” or “No” All (13) “Yes” votes received within timeout? Commit Wait! Can’t commit or abort before receiving next message!

Two-phase Commit Coordinator Server Server 1 Server 13 Prepare … Server 1 Server 13 Prepare Save updates to disk Respond with “Yes” or “No” All (13) “Yes” votes received within timeout? Commit Commit updates from disk to store OK

Failures in Two-phase Commit If server voted Yes, it cannot commit unilaterally before receiving Commit message If server voted No, can abort right away (why?) To deal with server crashes Each server saves tentative updates into permanent storage, right before replying Yes/No in first phase. Retrievable after crash recovery. To deal with coordinator crashes Coordinator logs all decisions and received/sent messages on disk After recovery or new election => new coordinator takes over 26

Failures in Two-phase Commit (2) To deal with Prepare message loss The server may decide to abort unilaterally after a timeout for first phase (server will vote No, and so coordinator will also eventually abort) To deal with Yes/No message loss, coordinator aborts the transaction after a timeout (pessimistic!). It must announce Abort message to all. To deal with Commit or Abort message loss Server can poll coordinator (repeatedly) 27

Using Paxos in Distributed Servers Atomic Commit Can instead use Paxos to decide whether to commit a transaction or not But need to ensure that if any server votes No, everyone aborts Ordering updates Paxos can also be used by replica group (for an object) to order all updates – iteratively do: Server proposes message for next sequence number Group reaches consensus (or not) 28

Summary Multiple servers in cloud Replication for Fault-tolerance Load balancing across objects Replication Flavors using concepts we learnt earlier Active replication Passive replication Transactions and distributed servers Two phase commit 29

Summary HW3, MP3 due next 30