Download presentation
Presentation is loading. Please wait.
1
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 15: Data Replication with Network Partitions & Transaction Processing Systems Professor Chen Li
2
ICS214BNotes 152 Network partitions Groups of nodes may be isolated or nodes may be slow in responding PP Net
3
ICS214BNotes 153 Network Partitions No replicated data –Quorum-based 3PC abort, commit quorums Replicated data –at most one operational group coterie propagation of updates
4
ICS214BNotes 154 Quorums C 1 = {{a,b,c}, {a,b,d}, {a,c,d}, {b,c,d}} A 1 = {{a,b}, {a,c}, {a,d}, {b,c}, {b,d}, {c,d}} Important property: X C 1 Y A 1 X Y Ø Y A 1 X C 1 X Y Ø. a b.. c. d
5
ICS214BNotes 155 Some quorums can be implemented with vote assignments To commit 3 To abort 2 Votes to commit + votes to abort > total votes Why? 1 1 1 1. a b.. c. d
6
ICS214BNotes 156 Not all quorums can be implemented via votes C 2 = {{a,b}, {c,d}} A 2 = {{a,c}, {a,d}, {b,c}, {b,d}} a b d c
7
ICS214BNotes 157 Proof C 2 = {{a,b}, {c,d}} A 2 = {{a,c}, {a,d}, {b,c}, {b,d}} Suppose it can be implemented via votes Let each site symbol represent its vote Let x be the commit threshold Let y be the abort threshold Commit:Abort: a + b >= x a + c >= y y > c + d x > b + d c + d >= x a + d >= y y > a + b x > b + c b + c >= y x > a + d b + d >= y x > a + c 2y > 2(a+b+c+d) >= 2x 4x > 4(a+b+c+d) >= 4y
8
ICS214BNotes 158 Another Proof C 2 = {{a,b}, {c,d}} A 2 = {{a,c}, {a,d}, {b,c}, {b,d}} Commit:Abort: a + b >= x a + c >= y c + d >= x a + d >= y b + c >= y b + d >= y 2 * () + 1 * () 4(a+b+c+d) >= 4x + 4y a+b+c+d >= x + y contradiction!
9
ICS214BNotes 159 Partitions and data replication Options: (1) All copies required for updates (2) Group may update, but at most one (at a time) (3) Any group may update
10
ICS214BNotes 1510 Updates by at most one group Coterie C 1 = {{a,b,c}, {a,b,d}, {a,c,d}, {b,c,d}} C 2 = {{a,b}, {a,c}, {a,d}, {b,c,d}} X 1 = {{a,b}, {c,d}} not valid Important property: S C G C, S G Ø. a b.. c. d
11
ICS214BNotes 1511 Reading replicated data C 1 = {{a,b,c}, {a,b,d}, {a,c,d}, {b,c,d}} R 1 = {{a,b}, {a,c}, {a,d},{b,c}, {b,d}, {c,d}} C 2 = R 2 = {{a,b}, {a,c}, {a,d}, {b,c,d}}. a b.. c. d
12
ICS214BNotes 1512 Reading replicated data - Votes C 1 = {{a,b,c}, {a,b,d}, {a,c,d}, {b,c,d}} R 1 = {{a,b}, {a,c}, {a,d},{b,c}, {b,d}, {c,d}}. a b.. c. d to write get 3 votes (V w ) to read get 2 votes (V R ) 1 1 1 1
13
ICS214BNotes 1513 Reading replicated data - Votes C 2 = R 2 = {{a,b}, {a,c}, {a,d}, {b,c,d}}. a b.. c. d to write get 3 votes (V w ) to read get 3 votes (V R ) 1 1 2 1
14
ICS214BNotes 1514 A Problem Example: a 3-node system, 1 vote each node, replicated data Now: T 1. aT 1 is committed at a,b. But after T1 writes data at b before it writes data at a, the network gets repartitioned. T 1. b. c
15
ICS214BNotes 1515 Later: T 1. aT 2 reads at c (not seeing T 1 );. b. cthen writes and commits at a, c Then c doesn’t see T1!
16
ICS214BNotes 1516 Solution Each node keeps list of committed transactions Whenever a new quorum is formed –Compare sequence numbers to see which node has the latest updates –All node apply latest updates –Then resume processing
17
ICS214BNotes 1517 Network Partitions: Summary No replicated data –abort, commit quorums Replicated data –at most one operational group coterie propagation of updates
18
ICS214BNotes 1518 Next: Transaction Processing Systems
19
ICS214BNotes 1519 Basic concepts Business Transactions –Real-world interaction On-line Transactions –execution of program that performs some function(s) of business transaction –steps: get inputs do work (access DB’s) produce response
20
ICS214BNotes 1520 Example applications ATMs –E.g., 1 trans per minute per ATM 60 ATMs 1 trans/sec Stock exchange
21
ICS214BNotes 1521 Transaction Processing System (TPS) servers clients Presentation manager Presentation manager transaction programs workflow control resource managers
22
ICS214BNotes 1522 TP Monitor The “operating system” for the TPS Functions: –manage processes that run trans. programs –load balancing –commit distributed transactions –route requests from clients to servers –etc.
23
ICS214BNotes 1523 TP monitor architecture Presentation server Workflow controller Transaction server Transaction server Network manager queues …. requests net
24
ICS214BNotes 1524 Two-tier Three-tier Client database server presentation workflow transaction servers
25
ICS214BNotes 1525 transactional communications TP monitor = “glue” and “veneer” TP application programs operating system services communi- cation services database system services user interface services TP monitor API veneer... request routing 2 phase commit
26
ICS214BNotes 1526 TP monitor functions: presentation communication clients-servers workflow management commit coordination process management security queue management...
27
ICS214BNotes 1527 Presentation services user interaction constructing requests authentication communication logging
28
ICS214BNotes 1528 User interaction Fred Smith check-in reservation query = Go Airlines = agent: task: do it
29
ICS214BNotes 1529 Flight no: Passenger: Date =Check In = today Storm heading our way!! Announcements: Search for passenger
30
ICS214BNotes 1530 Old-fashioned approach for client Display menu box of screen Wait for user inputsend msg to server Code that does everything -----
31
ICS214BNotes 1531 Client using TP monitor services: Check in schema: Flight: ___ Date: ___ Do_check_in schema: Flight: ___ Date: ___ DISPLAY_FORM (CHECK_IN); some logic [no date validation?] SEND_REQ (DO_CHECK_IN); some logic (what next?)......
32
ICS214BNotes 1532 Data validation in forms Best done using cached copy of valid values OK for static values e.g.: product codes, flight numbers Not OK for dynamic values e.g.: seats left in plane; account balance do this validation at server (can access DB)
33
ICS214BNotes 1533 Authentication: 2 levels user clientserver Do I know/trust user? Do I know/trust client?
34
ICS214BNotes 1534 Process Management REQ client server code that does the work more code db ?
35
ICS214BNotes 1535 OS Solution client1 server clientX Code for all REQ’s process 1 process X db... Problem: too many processes….. does not scale!
36
ICS214BNotes 1536 Old fashioned TP solution client1 server clientX db... - code for all REQ’s - threading implementation... single process: todo waiting
37
ICS214BNotes 1537 Problem: –complexity –need all application code in one process
38
ICS214BNotes 1538 Server processes client1 server clientX db... db code for req#1 code for req#2 workflow/ routing
39
ICS214BNotes 1539 Can be generalized: client1 clientX... db... db code for req#1 code for req#2 routing
40
ICS214BNotes 1540 Routing ? REQ Consider factors such as load balancing, failures…
41
ICS214BNotes 1541 do work NEXT: Inter-process communication router server process another process (eg DBMS) do work
42
ICS214BNotes 1542 Transactional RPC Transaction info (e.g., TRANS ID) is passed with calls Execution of server code becomes part of transaction client: start-trans call commit... server work... DB T 35 ( T 35 ) lock data for T 35 involve all resources for T 35
43
ICS214BNotes 1543 credit _card Example: client : start- trans pay_cc debit_bank commit... pay _cc work... debit _bank work accounts... T 88 777......... 333...... lock commit changes to credit_card and accounts
44
ICS214BNotes 1544 Fault tolerance in RPC Timeout: retry? give up? client: server : ____ work ____ call NO REPLY timeout: ??
45
ICS214BNotes 1545 Motivation for queues (a) server unavailable (b) server loses request clientserver clientserver ? req
46
ICS214BNotes 1546 client (c) client down (d) queues also useful for - load balancing - request priorities server ? req ans Motivation for queues
47
ICS214BNotes 1547 serverclient req queue enqueuedequeue other clients other servers (load balancing)
48
ICS214BNotes 1548 Trans#3: start_trans: dequeue (Q2) decode reply process output commi t client server Trans#1: start_trans: get inputs construct req enqueue (Q1) commit Trans#2: start_trans: dequeue (Q1); process req; enqueue (Q2); commit Q1: request queue Q2: reply queue
49
ICS214BNotes 1549 TP monitors and the web http web browser web server TP system daemon TP monitor client TP monitor protocol
50
ICS214BNotes 1550 Summary of TPS Architecture –Presentation services –Routing and workflow control –Process management Communication services –RPC –Queues
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.