Title: Advanced Distributed Transaction Processing with BEA WebLogic Server 6.0
1Ed Felt Sriram Srinivasan ed.felt_at_bea.com,
srirams_at_bea.com BEA Systems, Inc.
Advanced Distributed Transaction Processing with
BEA WebLogic Server 6.0
2Agenda
- Why use transactions?
- What capabilities does BEA WebLogic Server 6.0
provide? - How to program?
- How to configure and monitor?
- References
- Questions Answers
3Benefit 1 Data Consistency
- Ensure data integrity when accessing more than
one data store, especially in distributed
environment - Simple model for application programmer
- A - atomic
- C - consistent
- I - isolated
- D - durable
4Benefit 2 Monitoring Management
- A transaction is a higher-level unit of work than
a database query or an object invocation - BEA WebLogic Server allows transactions to be
given a semantic name (TransferFunds or
ReserveSeat or CheckOut) - Transaction Name is reported in error messages
- Statistics subtotals categorized by Transaction
Name
5Benefit 3 Timeouts Overload Protection
- Transactions are subject to timeout
- 30 second default
- Application code (or the EJB container) can mark
a transaction rollback only - In an overloaded system, BEA WebLogic Server
- Times out requests (who waits 30 seconds for a
Web page to return?) - Avoids wasted work on doomed transactions
- Eventually refuses to begin new transactions when
there are too many already running (configurable
parameter)
6Supported Configurations
- Multiple servers may participate in a distributed
transaction - Clustered or non-clustered
- Need not be in same administrative domain
- Requires connectivity and permissions
- Clients may initiate transactions and infect
multiple servers - Commit responsibility is handed off to a server
- Clients may not enlist resources or register
synchronization callbacks - Multiple XA resources may participate in same
transaction - More than one coordinated by two-phase commit
algorithm
7Relationship with Other Subsystems
- JDBC
- Recognized any JDBC driver that implements JDBC
2.0 XA extensions - BEA provides Type 2 XA driver for Oracle 8.1.6
client - JDBC wrapper enhances performance
- JMS
- Supports XA, can participate in JTA transactions
- All storage types database, file, non-persistent
- EJB
- Automatically manages transactions based on EJBs
deployment descriptor
8High-Level Architecture
EJB Container
Application
JMS
JDBC
JTA
JTA
JDBC Wrapper
JDBC
Transaction Manager
XA-Capable Resource
XA
9Performance Optimizations
- Boxcar algorithm for multiple commit records per
I/O - One-phase commit optimization
- Read-only branch optimization
- Dynamic resource enlistment optimization
- Piggy-back transaction propagation
- Multiple operations per coordination message
- Asynchronous, parallel coordination architecture
with retry
10Programming APIs
- Good news! In many cases, transactions are
controlled by the EJB Container, and an
application programmer writes no code for
transactions - The UserTransaction object provides simple
begin/commit/rollback functionality for
applications that need to explicitly demarcate
transaction boundaries - More powerful transaction objects normally used
by the Application Server and EJB Container are
available to applications with complex
transactional requirements - BEA WebLogic Server extensions for convenience
and added value
11JTA Interfaces
- UserTransaction
- Basic methods to begin, commit, rollback
transactions and get/set status - TransactionManager
- Adds suspend, resume, get threads current
Transaction object - Transaction
- Represents on transaction, controls enlistment
and synchronization - Synchronization
- Callback interface for before/after completion
notification - XAResource
- Xid
- Various exceptions and status codes
12BEA WebLogic Server Extensions
- weblogic.transaction.TxHelper
- Static methods to get Transaction,
UserTransaction, and TransactionManager objects - weblogic.transaction.Transaction
- Get/set transaction name, transaction properties
- Get/set rollback reason
- Get timeout information
- Get Xid
- weblogic.transaction.TransactionManager
- XA resource registration
- Get transaction object by Xid
- Force suspend/resume (without XA calls)
13Configuration Parameters (Per Domain)
- Transaction Timeout Seconds
- Default number of seconds for transaction
timeout, unless overridden by API call or EJB
container - Abandon Timeout Seconds
- After X number of seconds, stop trying to resolve
branch(es) of a committed transaction and log an
error - Should never happen unless resource dies during
commit processing and does not come back - Forget Heuristics
- When resource reports a heuristic completion, log
an error message and then tell resource to
forgetabout that transaction
14Configuration Parameters (Per Domain)
- Before Completion Iteration Limit
- Maximum number of times a server will iterate
through registered Synchronization objects for
the same transaction - Prevents infinite loops when one Synchronization
callback causes another Synchronization object
registration - Max Transactions
- Maximum number of transactions that can be
simultaneously active on a server - Max Unique Name Statistics
- Maximum number of transaction names remembered
for categorizing statistic subtotals
15Configuration Options
16Configuration Parameters (Per Server)
- Transaction Log File Prefix
- Each server that coordinates a two-phase commit
transaction writes to the transaction log at
commit time and reads the transaction log during
crash recovery - A transaction log is stored in multiple files
- Space is reclaimed automatically
- Never delete these files
- Default location is servers current directory
- Highly reliable file system is recommended (RAID,
etc.) - File naming convention
- Prefix ServerName 9999 .tlog (9999
unique number)
17Configuration Parameters (JDBC)
- Transaction branches
- Connection pool name determines transaction
branch qualifier - Different pool names cause separate branches,
even if connected to same database - Databases typically provide lock isolation
between branches, shared locks within a branch - Benefits of multiple branches
- Lock isolation protects independently developed
components from unexpected cross-interference - Drawbacks of multiple branches
- Lock conflicts can cause deadlock/timeout
- More overhead in transaction coordination, more
XA calls
18Configuration Parameters (JDBC)
- JDBCTxDataSource wrapper for non-XA database
drivers - If EnableTwoPhaseCommitfalse (the default) and
a non-XA JDBC driver is supplied, commit() will
fail unless this is the only transaction
participant - If EnableTwoPhaseCommittrue a non-XA JDBC
driver may participate in a transaction with
multiple participants, however there is a risk
that the non-XA driver might fail at commit time - This is reported as a heuristic rollback exception
19Monitoring
- Counters
- Overall
- Subtotal by XAResource
- Subtotal by Transaction name
- Specific transactions
- List transactions more than XX seconds old
- Old transactions are the most interesting ones
20Monitoring Summary
21Monitoring Stats by Name
22Monitoring Stats by Resource
23Monitoring Individual Transactions
24Coming Attractions
- Ongoing integration testing and cooperation with
XA resource providers - Support for transaction export/import to/from
external systems via interposed gateway
architecture - Additional internal enhancements for reliability,
overload tolerance, and performance - Additional management, monitoring, statistics
25References
- Specifications
- http//www.java.sun.com/products/jta
- http//www.java.sun.com/j2ee
- BEA WebLogic Server 6.0 Documentation
- http//e-docs.bea.com
- News Group
- news//newsgroups.bea.com/weblogic.developer.inter
est.transaction
26Questions Answers
QA