26
Ed Felt & Sriram Srinivasan [email protected], [email protected] BEA Systems, Inc. Advanced Distributed Transaction Processing with BEA WebLogic Server6.0

Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

  • Upload
    umay

  • View
    72

  • Download
    0

Embed Size (px)

DESCRIPTION

Ed Felt & Sriram Srinivasan [email protected], [email protected] BEA Systems, Inc. Advanced Distributed Transaction Processing with BEA WebLogic Server ™ 6.0. Agenda. Why use transactions? What capabilities does BEA WebLogic Server 6.0 provide? How to program? How to configure and monitor? - PowerPoint PPT Presentation

Citation preview

Page 1: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Ed Felt & Sriram Srinivasan [email protected], [email protected] Systems, Inc.

Advanced Distributed Transaction Processing with BEA WebLogic Server™ 6.0

Page 2: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Agenda

• Why use transactions?• What capabilities does BEA WebLogic Server 6.0 provide?• How to program?• How to configure and monitor?• References• Questions & Answers

Page 3: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Benefit #1: Data Consistency

• Ensure data integrity when accessing more than one data store, especially in distributed environment

• Simple model for application programmer:

AA - atomic

CC - consistent

II - isolated

DD - durable

Page 4: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Benefit #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

Page 5: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Benefit #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)

Page 6: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Supported 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

Page 7: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Relationship 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 EJB’s deployment descriptor

Page 8: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

High-Level Architecture

TransactionManager

XA-CapableResource

EJB Container

Application

JDBC WrapperJTA

JDBC

JMS

XA

JDBC

JTA

Page 9: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Performance 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

Page 10: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Programming 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

Page 11: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

JTA Interfaces

• UserTransaction– Basic methods to begin, commit, rollback transactions and get/set status

• TransactionManager– Adds suspend, resume, get thread’s 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

Page 12: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

BEA 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)

Page 13: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Configuration 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 “forget”about that transaction

Page 14: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Configuration 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

Page 15: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Configuration Options

Page 16: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Configuration 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 server’s current directory– Highly reliable file system is recommended (RAID, etc.)– File naming convention:

Prefix + ServerName + 9999 + “.tlog” (9999 = unique number)

Page 17: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Configuration 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

Page 18: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Configuration Parameters (JDBC)

• JDBCTxDataSource wrapper for non-XA database drivers– If EnableTwoPhaseCommit=“false” (the default) and a non-XA JDBC driver

is supplied, commit() will fail unless this is the only transaction participant– If EnableTwoPhaseCommit=“true” 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

Page 19: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Monitoring

• 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

Page 20: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Monitoring Summary

Page 21: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Monitoring Stats by Name

Page 22: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Monitoring Stats by Resource

Page 23: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Monitoring Individual Transactions

Page 24: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Coming 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

Page 25: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

References

• 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.interest.transaction

Page 26: Ed Felt & Sriram Srinivasan ed.felt@bea, srirams@bea BEA Systems, Inc

Questions & Answers