Docsity

Transaction Processing Systems: Structure and Properties, Slides of Fundamentals of E-Commerce

Toggle sidebar
bg1
1
1
12/27/04
1. Introduction
Transaction Pro ce ssing
2
12
/
27
/
04
Outline
1. The Basics
2. ACID Properties
3. Atom icity and Two-Phase Commit
4. Performance
5. Styles of System
3
12
/
27
/
04
1.1 The Basics -W hat’s a Transaction?
•The execution of a program that performs an
adm inistrative function by accessing a share d
database, usually on behalf of an on-line user.
Exam ples
•Reserve an airline se at. Buy an airline tick et
•Withdraw money from an ATM .
•Verify a cred it card sa le.
•Order an item from an Internet retailer
•Plac e a bid at an on-line auction
•Submit a corporate purchase order
4
12
/
27
/
04
The “ities” are What Makes
Transaction Pro cessing (TP) Hard
•Reliability -system sh o u ld rarely fail
•Availability -system must be up all the time
•R espon se time -within 1-2 sec on ds
•Throughput -thousands of tran sactions/se con d
•Scalab ility -start sm all, ram p up to Internet-scale
•Secu rity –for confidentiality and high finance
•Configurability -for above require m e n ts + low co st
•Atom icity -no partial re su lts
•Durab ility -a transaction is a legal contract
•Distribution -of users and data
5
12
/
27
/
04
What Makes TP Im portan t?
•It’s at the core of electronic com m erce
•Most medium -to-large businesses use TP for
their production sy stem s. The busin ess can’t
operate without it.
•It’s a huge slice of the com puter sy stem
market. One of the largest applications of
com puters.
6
12
/
27
/
04
TP System Infrastructure
•User’s view po int
–Enter a re q u e st from a brow ser or other disp lay device
–The sy stem perfo rm s som e application-specific work,
which includes datab ase accesses
–Receive a re p ly (usually, but not always)
•The TP system ensures that each transaction
–is an independent unit of work
–executes exactly once, and
–produces perm anent re su lts.
•TP system makes it easy to program transactions
•TP system has tools to make it easy to manage
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Transaction Processing Systems: Structure and Properties and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

12/27/ 04 1

1.Introduction

Transaction Processing

12/27/ 04 2

O utline

1.The Basics

2.A CID Properties

3.A tom icity and Tw o-Phase Com m it

4.Perform ance

5.Styles ofSystem

12/27/ 04 3

1.1 The Basics -W hat’s a Transaction?

  • The execution ofa program thatperform s an

adm inistrative function by accessing a shared

database,usually on behalfofan on-line user.

Exam ples

  • Reserve an airline seat.Buy an airline ticket
  • W ithdraw m oney from an A TM.
  • V erify a creditcard sale.
  • O rderan item from an Internetretailer
  • Place a bid atan on-line auction
  • Subm ita corporate purchase order 12/27/ 04 4

The “ities” are W hatM akes

Transaction Processing (TP)H ard

  • Reliability -system should rarely fail
  • A vailability -system m ustbe up allthe tim e
  • Response tim e -w ithin 1-2 seconds
  • Throughput-thousands oftransactions/second
  • Scalability -startsm all,ram p up to Internet-scale
  • Security – forconfidentiality and high finance
  • Configurability -forabove requirem ents + low cost
  • A tom icity -no partialresults
  • D urability -a transaction is a legalcontract
  • D istribution -ofusers and data

12/27/ 04 5

W hatM akes TP Im portant?

  • It’s atthe core ofelectronic com m erce
  • M ostm edium -to-large businesses use TP for

theirproduction system s.The business can’t

operate w ithoutit.

  • It’s a huge slice ofthe com putersystem

m arket.O ne ofthe largestapplications of

com puters.

12/27/ 04 6

TP System Infrastructure

  • U ser’s view point
    • Entera requestfrom a brow serorotherdisplay device
    • The system perform s som e application-specific w ork, w hich includes database accesses
    • Receive a reply (usually,butnotalw ays)
  • The TP system ensures thateach transaction
    • is an independentunitofw ork
    • executes exactly once,and
    • produces perm anentresults.
  • TP system m akes iteasy to program transactions
  • TP system has tools to m ake iteasy to m anage

2

12/27/ 04 7

TP System Infrastructure … D efines System and A pplication Structure

Presentation M anager

W orkflow C ontrol (routes requests and supervises theirexecution)

D atabase System

Front-End (C lient)

Back-End (Server)

End-U ser

Transaction Program

requests

12/27/ 04 8

System Characteristics

  • Typically < 100 transaction types perapplication
  • Transaction size has high variance.Typically,
    • 0-30 disk accesses
    • 10K -1M instructions executed
    • 2-20 m essages
  • A large-scale exam ple:airline reservations
    • 150,000 active display devices
    • plus indirectaccess via Internet
    • thousands ofdisk drives
    • thousands oftransactions persecond,peak

12/27/ 04 9

A vailability

  • Fraction oftim e system is able to do usefulw ork
  • Som e system s are very sensitive to dow ntim e
    • airline reservation,stock exchange,telephone sw itching
    • dow ntim e is frontpage new s
  • Contributing factors
  • failures due to environm ent,system m gm t,h/w ,s/w
  • recovery tim e

D ow ntim e A vailability 1 hour/day 95.8% 1 hour/w eek 99.41% 1 hour/m onth 99.86% 1 hour/year 99.9886% 1 hour/20years 99.99942%

12/27/ 04 10

A pplication Servers

  • A softw are productto create,execute and m anage TP applications
  • Form erly called TP m onitors.Som e people say A pp Server= TP m onitor+ w eb functionality.
  • Program m erw rites an app to process a single request. A pp Serverscales itup to a large,distributed system - E.g.application developerw rites program sto debita checking accountand verify a creditcard purchase. - A pp Serverhelps system engineerdeploy itto 10s/100sof servers and 10Ks ofdisplays - A pp Serverhelps system engineerdeploy iton the Internet, accessible from w eb brow sers

12/27/ 04 11

A pplication Servers (cont’d)

  • Com ponents include
    • an application program m ing interface (A PI) (e.g.,Enterprise Java Beans)
    • tools forprogram developm ent
    • tools forsystem m anagem ent(app deploym ent, fault& perform ance m onitoring,userm gm t,etc.)
  • Enterprise Java Beans,IBM W ebsphere,

M icrosoft.N ET (CO M +),BEA W eblogic,

O racle A pplication Server

12/27/ 04 12

Presentation Server

W orkflow C ontroller

Transaction Server Transaction Server

N etw ork

R equests

M essage Inputs

A pp ServerA rchitecture,pre-W eb

  • Boxes below are distributed on an intranet

Q ueues

4

12/27/ 04 19

W orkflow System s

  • A softw are productthatexecutes m ulti-transaction long-running scripts (e.g.process an order)
  • Productcom ponents
    • A w orkflow scriptlanguage
    • W orkflow scriptinterpreterand scheduler
    • W orkflow tracking
    • M essage translation
    • A pplication and queue system adaptors
  • Transaction-centric vs.docum ent-centric
  • Structured processes vs.case m anagem ent
  • IBM W ebsphere M Q W orkflow ,M icrosoftBizTalk,SA P, V itria,O racle W orkflow ,FileN ET,D ocum entum ,…. 12/27/ 04 20

System Softw are V endor’s V iew

  • TP is partly a com ponentproductproblem
    • H ardw are
    • O perating system
    • D atabase system
    • A pplication Server
  • TP is partly a system engineering problem
    • G etting allthose com ponents to w ork together to produce a system w ith allthose “ilities”.
  • This course focuses prim arily on the

D atabase System and A pplication Server

12/27/ 04 21

O utline

1.The Basics 2.A CID Properties 3.A tom icity and Tw o-Phase Com m it 4.Perform ance 5.Styles ofSystem

12/27/ 04 22

1.2 The A CID Properties

  • Transactions have 4 m ain properties
    • A tom icity -allornothing
    • Consistency -preserve database integrity
    • Isolation -execute as ifthey w ere run alone
    • D urability -results aren’tlostby a failure

12/27/ 04 23

A tom icity

  • A ll-or-nothing,no partialresults.
    • E.g.in a m oney transfer,debitone account,creditthe other.Eitherdebitand creditboth run,orneitherruns.
    • Successfulcom pletion is called Com m it.
    • Transaction failure is called Abort.
  • Com m itand abortare irrevocable actions.
  • A n A bortundoes operations thatalready executed
    • Fordatabase operations,restore the data’s previous value from before the transaction
    • Butsom e realw orld operations are notundoable. Exam ples -transferm oney,printticket,fire m issile 12/27/ 04 24

Exam ple -A TM D ispenses M oney

(a non-undoable operation)

T1: Start

... Commit Dispense Money

T1: Start

... Dispense Money Commit

System crashes

D eferred operation never gets executed

System crashes Transaction aborts M oney is dispensed

5

12/27/ 04 25

Reading U ncom m itted O utputIsn’t U ndoable T1: Start ... Display output ... If error, Abort

T2: Start Get input from display ... Commit

U serreads output … U serenters input Brain transport

12/27/ 04 26

Com pensating Transactions

  • A transaction thatreverses the effectofanother

transaction (thatcom m itted).Forexam ple,

  • “A djustm ent” in a financialsystem
  • A nnula m arriage
  • N otalltransactions have com plete com pensations
  • E.g.Certain m oney transfers
  • E.g.Fire m issile,cancelcontract
  • Contractlaw talks a lotaboutappropriate com pensations

G A w ell-designed TP application should have a

com pensation forevery transaction type

12/27/ 04 27

Consistency

Every transaction should m aintain D B consistency

  • Referentialintegrity -E.g.each orderreferences an existing custom ernum berand existing partnum bers
  • The books balance (debits = credits,assets = liabilities)

G Consistency preservation is a property ofa

transaction,notofthe TP system

(unlike the A ,I,and D ofA CID )

  • Ifeach transaction m aintains consistency,

then serialexecutions oftransactions do too.

12/27/ 04 28

Som e N otation

  • ri[x]= Read(x)by transaction T (^) i
  • w (^) i[x]= W rite(x)by transaction T (^) i
  • ci = Com m itby transaction T (^) i
  • ai = A bortby transaction T (^) i
  • A history is a sequence ofsuch operations,

in the orderthatthe database system

processed them.

12/27/ 04 29

Consistency Preservation Exam ple T 1 :Start; A = Read(x); A = A -1; W rite(y,A ); Com m it;

T 2 :Start; B = Read(x); C = Read(y); If (B > C+1)then B = B -1; W rite(x,B); Com m it;

  • Consistency predicate is x > y.
  • Serialexecutions preserve consistency.

Interleaved executions m ay not.

  • H = r 1 [x]r 2 [x]r 2 [y]w 2 [x]w 1 [y]
    • e.g.try itw ith x=4 and y=2 initially 12/27/ 04 30

Isolation

  • Intuitively,the effectofa setoftransactions

should be the sam e as ifthey ran independently

  • Form ally,an interleaved execution of

transactions is serializable ifitseffectis

equivalentto a serialone.

  • Im plies a userview w here the system runs each

user’s transaction stand-alone.

  • O fcourse,transactions in factrun w ith lots of

concurrency,to use device parallelism.

7

12/27/ 04 37

Tw o-Phase Com m it

  • M ain idea -allresource m anagers (RM s)save a

durable copy ofthe transaction’s updates before

any ofthem com m it.

  • Ifone RM fails afteranothercom m its,the failed

RM can stillcom m itafteritrecovers.

  • The protocolto com m ittransaction T
    • Phase 1 -T’s coordinatorasks allparticipantRM sto “prepare the transaction”. Each participantRM replies “prepared” afterT’s updates are durable.
    • Phase 2 -A fterreceiving “prepared” from all participantRM s,the coordinatortells allparticipant RM sto com m it. 12/27/ 04 38

Tw o-Phase Com m it System A rchitecture

Resource M anager

Transaction M anager(TM )

A pplication Program

O ther Transaction M anagers 1.Starttransaction returns a unique transaction identifier 2.Resource accesses include the transaction identifier. Foreach transaction,RM registers w ith TM 3.W hen application asks TM to com m it,the TM runs tw o-phase com m it.

Start Commit, Abort

Read, Write

12/27/ 04 39

O utline

1.The Basics 2.A CID Properties 3.A tom icity and Tw o-Phase Com m it 4.Perform ance 5.Styles ofSystem

12/27/ 04 40

1.4 Perform ance Requirem ents

  • M easured in m ax transaction persecond (tps)or

perm inute (tpm ),and dollars pertpsortpm.

  • D ollars m easured by listpurchase price plus 5 year

vendorm aintenance (“costofow nership”)

  • W orkload typically has this profile:
    • 10% application serverplus application
    • 30% com m unications system (notcounting presentation)
    • 50% D B system
  • TP Perform ance Council(TPC)sets standards
    • http://w w w .tpc.org.
  • TPC A & B (‘89-’95),now TPC C & W

12/27/ 04 41

TPC-A /B — Bank Tellers

Start Read message from terminal (100 bytes) Read+write account record (random access) Write history record (sequentialaccess) Read+write teller record (random access) Read+write branch record (random access) Write message to terminal (200 bytes) Commit

  • End ofhistory and branch records are bottlenecks
    • O bsolete (a retired standard),butinteresting
    • Inputis 100 byte m essage requesting deposit/w ithdraw al
    • D atabase tables = {A ccounts,Tellers,Branches,H istory}

12/27/ 04 42

The TPC-C O rder-Entry Benchm ark

  • TPC-C uses heavierw eighttransactions

Table R ow s/W hse B ytes/row W arehouse 1 89 D istrict 10 95 C ustom er 30K 655 H istory 30K 46 O rder 30K 24 N ew -O rder 9K 8 O rderLine 300K 54 Stock 100K 306 Item 100K 82

8

12/27/ 04 43

TPC-C Transactions

  • N ew -O rder
    • G etrecords describing a w arehouse,custom er,& district
    • U pdate the district
    • Increm entnextavailable ordernum ber
    • Insertrecord into O rderand N ew -O rdertables
    • For5-15 item s,getItem record,get/update Stock record
    • InsertO rder-Line Record
  • Paym ent,O rder-Status,D elivery,Stock-Levelhave

sim ilarcom plexity,w ith differentfrequencies

  • tpm C = num berofN ew -O rdertransaction perm in.

12/27/ 04 44

Com m ents on TPC-C

  • Enables apples-to-apples com parison ofTP

system s

  • D oes notpredicthow yourapplication w illrun,

orhow m uch hardw are you w illneed,

orw hich system w illw ork beston yourw orkload

  • N otallvendors optim ize forTPC-C.
    • Som e high-end system sales require custom benchm arks.

12/27/ 04 45

TypicalTPC-C N um bers

  • A llnum bers are highly sensitive to date subm itted.
  • $1.50 -$9 /tpm C forresults released in 2004.
    • Low end num bers are alm ostallM S SQ L Server& W indow s.
    • H igh end ism ostly O racle and IBM ,Linux,BEA Tuxedo
  • System cost$27K (H P)-$17M (IBM )
  • Exam ples ofhigh throughput(64-processorsystem s)
    • IBM ,3.2M tpm C,$16.7M ,$5.19/tpm C (5/15/05 IBM D B2,W indow s,M S CO M +)
    • H P,1.2M tpm C,$6.5M ,$5.50/tpm C (4/30/04,O racle 10g,Red H atLinux,BEA Tuxedo)
  • Exam ples oflow cost(M S SQ L Server,W indow s,CO M +)
    • H P ProLiant,18K tpm C,$31K,$1.70/tpm C,4/14/ 04
    • D ell,26K tpm C,$40K,$1.50/tpm C,12/ 04 12/27/ 04 46

TPC-W – W eb Retailer

  • Introduced 12/99.Effectively retired in 2003 because it allow ed “benchm ark special” solutions
  • Features -dynam ic w eb page generation,m ultiple brow ser sessions,secure U I& paym ents (via secure socket layer)
  • Profiles - shop (WIPS), browse (WIPSb), order (WIPSo)
    • Tables – {Customer, Order, Order-Line, Item, Author, CreditCardTxns, Address, Country}
    • Transactions – HomeWeb, ShoppingCart, Admin-Request, AdminConfirm, CustomerRegister, Buy-Request, BuyConfirm, OrderInquiry, OrderDisplay, Search, SearchResult, NewProducts, …
  • W eb Interactions persec (W IPS)@ ScaleFactor
    • ScaleFactor=1K – 10M item s(in the catalog).

12/27/ 04 47

Com ing Soon

  • TPC A pp
    • A replacem entforTPC-W .Com pletely differentbutw eb- focused.U nclearifitw illbe approved.
  • TPC-E
    • Like TPC-C,it’s database-centric,buta differentapplication
    • M ore realistic disk configuration (sm aller% oftotalprice)
    • Possibly w illhave a processorscalability m etric

12/27/ 04 48

O utline

1.The Basics 2.A CID Properties 3.A tom icity and Tw o-Phase Com m it 4.Perform ance 5.Styles ofSystem

10

12/27/ 04 55

O utline

1.The Basics 2.A CID Properties 3.A tom icity and Tw o-Phase Com m it 4.Perform ance 5.Styles ofSystem

12/27/ 04 56

W hat’s N ext?

  • This chaptercovered TP system structure and

properties oftransactions and TP system s

  • The restofthe course drills deeply into each

ofthese areas,one by one.