Docsity

Durability - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Toggle sidebar
bg1
A Serializability Example
•H = r1[x] r2[x] w1[x] c1 w2[y] c2
•H is equivalent to executing T2 followed by T1
•Note, H is not equivalent to T1 followed by T2
•Also, note that T1 started before T2 and finished
before T2, yet the effect is that T2 ran first.
T1: Start;
A = Read(x);
A = A + 1;
Write(x, A);
Commit;
T2: Start;
B = Read(x);
B = B + 1;
Write(y, B);
Commit;
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Durability - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

A Serializability Example • H = r[x]^ r[x]^ w[x] cw 1211

[y] c 22

-^ H is equivalent to executing T

followed by T 2 1

-^ Note, H is^ not^ equivalent to T

followed by T 1 2

-^ Also, note that T

started before T 1 2 and finished before T, yet the effect is that T^2

ran first. 2 T: Start;^1 A = Read(x);A = A + 1;Write(x, A);Commit;

T: Start;^2 B = Read(x);B = B + 1;Write(y, B);Commit;

Serializability Examples (cont’d) • Client must control the relative order oftransactions, using handshakes(wait for Tto commit before submitting T^1

-^ Some more serializable executions:r[x]^ r[y] w[y]^122

w[x]^ ≡^ TT≡^ TT^11 2

1 r[y]^ r[y] w[y]^ w^1221

[x]^ ≡^ TT≡^ TT^1 2 2 r[x]^ r[y] w[y]^ w^1221

[y]^ ≡^ TT≡^ TT^2 1 1

-^ Serializability says the execution is equivalent to^ some^ serial order, not necessarily to

all^ serial ordersDocsity.com

Durability

-^ When a transaction commits, its results willsurvive failures (e.g. of the application, OS,DB system … even of the disk). •^ Makes it possible for a transaction to be a legalcontract. •^ Implementation is usually via a log^ –^ DB system writes all transaction updates to its log^ –^ to commit, it adds a record “commit(T

)” to the logi

-^ when the commit record is on disk, the transaction iscommitted. –^ system waits for disk ack before acking to user

Outline 1. The Basics 2. ACID Properties3. Atomicity and Two-Phase Commit4. Performance5. Styles of System

Two-Phase Commit • Main idea - all resource managers (RMs) save adurable copy of the transaction’s updates before any of them commit. • If one RM fails after another commits, the failedRM can still commit after it recovers. • The protocol to commit transaction T – Phase 1 - T’s coordinator asks all participant RMs to“prepare the transaction”. Each participant RM replies“prepared” after T’s updates are durable. – Phase 2 - After receiving “prepared” from

all participant RMs, the coordinator tells all participantRMs to commit.

Two-Phase CommitSystem Architecture Application Program Resource^ TransactionManagerManager (TM)

OtherTransactionManagers

  1. Start transaction returns a unique

transaction identifier

  1. Resource accesses include the transaction identifier.For each transaction, RM registers with TM3. When application asks TM to commit, the TM runstwo-phase commit. Read,^ StartWriteCommit, Abort

1.4 Performance Requirements • Measured in max transaction per second (tps) orper minute (tpm), and dollars per tps or tpm. • Dollars measured by list purchase price plus 5 yearvendor maintenance (“cost of ownership”) • Workload typically has this profile: – 10% application server plus application – 30% communications system (not countingpresentation) – 50% DB system • TP Performance Council (

TPC)^ sets standards

-^ http://www.tpc.org. • TPC A & B (‘89-’95), now TPC C &W