06_Verteilte_Transaktionen

Download Report

Transcript 06_Verteilte_Transaktionen

VI.1
Distributed Transactions
Integration of transaction processing
VI.2
OLTP (Online Transaction Processing) :
(Distributed) Transaction processing:
Trusted data processing, also during system failures and multi-user access
Application examples:
- Reservation systems (Booking)
- Bank transactions
- Accounting
- Generally: data access in write mode
Implementation via TP-Systems / TP-Monitors, since 1960
System examples: -
JDBC (pure access interface)
CICS (IBM)
IMS (IBM)
Encina (Transarc / IBM)
Tuxedo (BEA Systems)
VI.3
JDBC (Java Database Connectivity)
• Programming interface for access to relational data bases
• Corresponds to ODBC (Open Database Connectivity)
• Numerous drivers for different data bases (for instance,
Oracle, Sybase, DB2, SQL Server etc.)
• Realizes however only direct data base access; improved
distributed transaction logic in heterogenic systems
requires Transaction Services/ Transaction monitors
Database access via JDBC
VI.4
try
{//open transaction
BankServer.con.setAutoCommit(false);
//UPDATE Account
pstmt = BankServer.con.prepareStatement("UPDATE Account SET
Balance=Balance-? WHERE AccountNumber=? ");
//Account
pstmt.setDouble(1, Amount);
//Amount
pstmt.setInt(2, Account);
int updated = pstmt.executeUpdate();
pstmt.close();
//Clean-up
//SELECT AccountStatus and READ CreditLimite
pstmt = BankServer.con.prepareStatement("SELECT X.Balance,
Y.CreditLimite FROM Account X, Client Y WHERE X.AccountNumber=?
AND X.ClientNumber=Y.ClientNumber");
pstmt.setInt(1, Account);
rs=pstmt.executeQuery();
BankServer.con.commit();
} //end of transaction
Distributed transaction: example
Booking 1
Account
server S1
Client
(Cash
desk)
Booking 2
(tied
booking)
Transaction
monitor
VI.5
Account
server S2
Trustiness:
Booking is realized also
in the case of failure
of Client, S1, S2 or
network failure
finally.
Atomicity and
Consistency:
Composed operations
are realized completely
or not at all
VI.6
Transactions and ACID-criteria
Transactions protect the ACID-criteria:
• ACID
Atomarity
Call completely or without impacts
Consistency
Transformation between consistent states
Isolation
No overlapping of transaction executions
Durability
Survival of system failures
VI.7
Realization of fault tolerance
Syntactic support of the example:
begin_distributed_transaction
subtract(account1, amount);
add(account2, amount);
end_distributed_transaction
abort_distributed_transaction
 Server 1
 Server 2
// in the error case
Isolation:
special concurrency control mechanisms
Other properties:
2-Phase-Commit-Protocol with persistent data storage
VI.8
Two-Phase-Commit (2PC-Protocol)
old Version: K
save Data: K‘
Participant
(for instance,
Server 1)
Coordinator
(for instance,
Client)
K := K‘
Old Version: L
save Data: L‘
Participant
(for instance,
Server 2)
L := L‘
VI.9
Two-Phase-Commit: Protocol
Input from the network /
Output to the network
start
- / prepare
start
prepare / abort
wait
abort / abort
ready / abort
prepare / ready
ready
ready / commit
commit / abort / -
aborted
commited
a) Coordinator
aborted
b) Participant
commited
Transaction monitor: system example Encina
Applications and Tools
Screen
Managers
Transaction Resource
Processing Managers
Services
Base Services
Operating and Transport system
Properties:
-TP-Monitor
- Integration of different data bases (RDBMS;
relational data bases) and transaction monitors
(for instance, CICS over LU 6.2 - SNA)
- Integration with CORBA and EJB
- Standard conformity (XA, X/Open, ISO/OSI, TP)
VI.10
VI.11
Example
transaction {...
book ("Lufthansa","FRA-JFK");
book ("USAir","JFK-SFA");
output_ticket();
...}
Possible operations:
- local transactions
- remote object calls
- call of other TP-Monitors
- nested transactions
Scenario:
Resource Managers
Application
server
Application
server
Clients
Mainframe
Special implementation aspects
VI.12
-Optimization via serving of several clients via one server process
(multi-threaded)
-Replication of the servers and partially automatic, heuristic load balancing,
fault tolerance
- Parallel transactions:
transaction {...
concurrent {...
book ("Lufthansa","FRA-JFK");
book ("USAir","JFK-SFA");
output_ticket();
...}
...}
onCommit
printf ("OK");
onAbort
printf ("Failure");
Migration and Host-Integration
Example: Integration with CICS
Server (Unix)
CPI-C
CPI-C
SNA
CORBA /
EJB
LU 6.2
Clients
Internet SNA
CPI-C
Mainframe
•Encina as CICS region (from point of view of the mainframe)
•Access to mainframe data base possible
Basis:
•SNA-Gateway; but today also TCP/IP in mainframe
environment available
•CPI-C (Common Programming Interface for Communications
from IBM SAA-Systems Application Architecture)
•COBOL-interface to transactional Encina-data systems
VI.13
System administration
Central administrator interface:
MonitorServer
Configuration
data base
Administrator
- Structuring in the management area
- Software distribution: Distributed File System
- Parallel system installation on the basis of configuration
data base
- Transactional Online Backup
VI.14
System administration
- Re-configuration of application servers via starts / stoppages
(online)
- Monitoring (for instance, number of transactions, blocking
transactions; also with selective filtering)
- Automatic re-start of servers after failures
- Step-by-step-mode Software-Upgrade (two parallel versions
possible)
- Uniform management user interface
VI.15
VI.16
Tuxedo (BEA Systems)
•
•
•
•
•
•
Transaction Monitor, comparable with Encina, XA-conform
Synchronous and asynchronous transactional calls
Reliable Message Queuing
Event Communication
Language support for C, C++, Cobol, Java
Wide availability
VI.17
Nested transactions
Problem of simple transactions:
– backtracking of larger calculations during long operations
– lack of parallelism
 Nested transactions with parallel partial transactions
Properties:
– separate backtracking of partial transactions
– selective repeats
– abortion of all partial transactions during abortion of the general
transaction
( Data versions to keep until end)
– inheritance of locks in both directions inside the hierarchy
Systems: Encina, Tuxedo
VI.18
Example of nested transactions
Document processing
Format
Preprocessor
Formatter
Save
Copy 1
Print
Copy 2
Preparation
Print
operation
Summary: Transactions
OLTP / TP-Monitors are essential components
for commercial applications
Trusted, consistent, distributed data management
Optional nested transactions, loading balancing, security aspects
Integration with mainframe systems (for instance, CICS-Monitor)
Important products: Encina (Transarc)
Tuxedo (BEA Systems)
Improvement in the Internet-area: TIP (Transaction Internet
Protocol): flexible Two-Phase-Commit via TCP/IP
VI.19