CS 425 / ECE 428 Distributed Systems Fall 2017

Similar documents
Basic vs. Reliable Multicast

CSE 544 Principles of Database Management Systems. Alvin Cheung Fall 2015 Lecture 14 Distributed Transactions

Distributed systems. Lecture 6: distributed transactions, elections, consensus and replication. Malte Schwarzkopf

Topics in Reliable Distributed Systems

Paxos provides a highly available, redundant log of events

Causal Consistency and Two-Phase Commit

Distributed System. Gang Wu. Spring,2018

Fault Tolerance. o Basic Concepts o Process Resilience o Reliable Client-Server Communication o Reliable Group Communication. o Distributed Commit

Replication in Distributed Systems

Last time. Distributed systems Lecture 6: Elections, distributed transactions, and replication. DrRobert N. M. Watson

Transactions. CS 475, Spring 2018 Concurrent & Distributed Systems

Recovering from a Crash. Three-Phase Commit

Fault Tolerance. Goals: transparent: mask (i.e., completely recover from) all failures, or predictable: exhibit a well defined failure behavior

CS /15/16. Paul Krzyzanowski 1. Question 1. Distributed Systems 2016 Exam 2 Review. Question 3. Question 2. Question 5.

CSE 486/586: Distributed Systems

Distributed Systems. Day 13: Distributed Transaction. To Be or Not to Be Distributed.. Transactions

Today: Fault Tolerance

PRIMARY-BACKUP REPLICATION

Fault Tolerance Causes of failure: process failure machine failure network failure Goals: transparent: mask (i.e., completely recover from) all

Distributed Systems. 09. State Machine Replication & Virtual Synchrony. Paul Krzyzanowski. Rutgers University. Fall Paul Krzyzanowski

Module 8 Fault Tolerance CS655! 8-1!

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 13 - Distribution: transactions

CprE Fault Tolerance. Dr. Yong Guan. Department of Electrical and Computer Engineering & Information Assurance Center Iowa State University

DISTRIBUTED SYSTEMS [COMP9243] Lecture 5: Synchronisation and Coordination (Part 2) TRANSACTION EXAMPLES TRANSACTIONS.

DISTRIBUTED SYSTEMS [COMP9243] Lecture 5: Synchronisation and Coordination (Part 2) TRANSACTION EXAMPLES TRANSACTIONS.

Distributed Systems COMP 212. Revision 2 Othon Michail

Introduction to Transaction Management

Fault Tolerance. Distributed Systems. September 2002

EECS 498 Introduction to Distributed Systems

Distributed Systems Consensus

Exam 2 Review. October 29, Paul Krzyzanowski 1

Recap. CSE 486/586 Distributed Systems Paxos. Paxos. Brief History. Brief History. Brief History C 1

Distributed Systems. replication Johan Montelius ID2201. Distributed Systems ID2201

CS5412: TRANSACTIONS (I)

Today: Fault Tolerance. Fault Tolerance

CSE 5306 Distributed Systems

CS October 2017

CSE 5306 Distributed Systems. Fault Tolerance

Synchronization. Clock Synchronization

Module 7 - Replication

ATOMIC COMMITMENT Or: How to Implement Distributed Transactions in Sharded Databases

TWO-PHASE COMMIT ATTRIBUTION 5/11/2018. George Porter May 9 and 11, 2018

Proseminar Distributed Systems Summer Semester Paxos algorithm. Stefan Resmerita

Database Recovery. Dr. Bassam Hammo

(Pessimistic) Timestamp Ordering

Parallel Data Types of Parallelism Replication (Multiple copies of the same data) Better throughput for read-only computations Data safety Partitionin

Synchronization. Chapter 5

Goal A Distributed Transaction

CS 425 / ECE 428 Distributed Systems Fall 2017 Indranil Gupta (Indy) August 29 December 12, 2017 Lecture 1-29

Fault Tolerance. Basic Concepts

Replications and Consensus

Recall: Primary-Backup. State machine replication. Extend PB for high availability. Consensus 2. Mechanism: Replicate and separate servers

(Pessimistic) Timestamp Ordering. Rules for read and write Operations. Read Operations and Timestamps. Write Operations and Timestamps

Lecture XII: Replication

Distributed Systems. 19. Fault Tolerance Paul Krzyzanowski. Rutgers University. Fall 2013

Module 8 - Fault Tolerance

Paxos and Raft (Lecture 21, cs262a) Ion Stoica, UC Berkeley November 7, 2016

Paxos Made Live. An Engineering Perspective. Authors: Tushar Chandra, Robert Griesemer, Joshua Redstone. Presented By: Dipendra Kumar Jha

Mobile and Heterogeneous databases Distributed Database System Transaction Management. A.R. Hurson Computer Science Missouri Science & Technology

Synchronization Part 2. REK s adaptation of Claypool s adaptation oftanenbaum s Distributed Systems Chapter 5 and Silberschatz Chapter 17

Introduction to Data Management CSE 344

Today: Fault Tolerance. Reliable One-One Communication

Practical Byzantine Fault

MYE017 Distributed Systems. Kostas Magoutis

Distributed Commit in Asynchronous Systems

EECS 498 Introduction to Distributed Systems

Distributed Systems (5DV147)

Transaction Management. Chapter 14

CSE 444: Database Internals. Section 9: 2-Phase Commit and Replication

Introduction to Data Management CSE 344

Page 1. Goals of Today s Lecture. The ACID properties of Transactions. Transactions

Performance and Forgiveness. June 23, 2008 Margo Seltzer Harvard University School of Engineering and Applied Sciences

Consistency in Distributed Systems

Database management system Prof. D. Janakiram Department of Computer Science and Engineering Indian Institute of Technology, Madras

CSE 124: REPLICATED STATE MACHINES. George Porter November 8 and 10, 2017

CSE 486/586 Distributed Systems

Chapter 8 Fault Tolerance

Consensus and related problems

Extend PB for high availability. PB high availability via 2PC. Recall: Primary-Backup. Putting it all together for SMR:

TAPIR. By Irene Zhang, Naveen Sharma, Adriana Szekeres, Arvind Krishnamurthy, and Dan Ports Presented by Todd Charlton

Distributed Systems. Characteristics of Distributed Systems. Lecture Notes 1 Basic Concepts. Operating Systems. Anand Tripathi

Distributed Systems. Characteristics of Distributed Systems. Characteristics of Distributed Systems. Goals in Distributed System Designs

Transactions. Intel (TX memory): Transactional Synchronization Extensions (TSX) 2015 Donald Acton et al. Computer Science W2

Distributed Systems 8L for Part IB

Introduction to Data Management CSE 344

Database System Concepts

Replication and Consistency. Fall 2010 Jussi Kangasharju

Today: Fault Tolerance. Failure Masking by Redundancy

Two phase commit protocol. Two phase commit protocol. Recall: Linearizability (Strong Consistency) Consensus

Control. CS432: Distributed Systems Spring 2017

Introduction to Data Management CSE 344

Consistency. CS 475, Spring 2018 Concurrent & Distributed Systems

Distributed Systems COMP 212. Lecture 19 Othon Michail

Fault Tolerance Part I. CS403/534 Distributed Systems Erkay Savas Sabanci University

Integrity in Distributed Databases

CSE 486/586 Distributed Systems

Primary-Backup Replication

Synchronization Part II. CS403/534 Distributed Systems Erkay Savas Sabanci University

Database System Concepts

Chapter 15: Transactions

Transcription:

CS 425 / ECE 428 Distributed Systems Fall 2017 Indranil Gupta (Indy) Nov 7, 2017 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 = = (1 f) 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 1. Replication Transparency A client ought not to be aware of multiple copies of objects existing on the server side 2. Replication Consistency All clients see single consistent copy of data, in spite of replication For transactions, guarantee ACID 6

Replication Transparency Client Client Client Front ends provide replication transparency Front End Front End Replica 1 Replica 2 Replica 3 Replicas of an object O Requests (replies flow opposite) 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 Replica 1 Master => total ordering of all updates On master failure, run election Client Front End Replica 2 Master (elected leader) Client Client Front End Replica 3 Requests (replies flow opposite) 9

Active Replication Client Client Client Front ends provide replication transparency Front End Front End Replica 1 Replica 2 Replica 3 Multicast inside Replica group Requests (replies flow opposite) 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... Object Y Server 1 Server 13 Object Z 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 Transaction T write(a,1); write(b,2); write(y, 25); write(z, 26); commit Coordinator Server... Object A Object B... Server 1 Server 13 Special server called Coordinator Object Y initiates atomic commit Tells other servers to either Object Z commit or abort 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 Prepare Server 1 Server 13 20

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

Two-phase Commit Coordinator Server Prepare Server 1 Server 13 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 Prepare Server 1 Server 13 Save updates to disk Respond with Yes or No All (13) Yes votes received within timeout? Commit

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

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

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