Gentle Breeze

[Transaction] XA vs non XA 본문

⑨ 직무역량강화/Transaction

[Transaction] XA vs non XA

재령 2012. 1. 6. 11:08
참고 사이트 : http://jroller.com/pyrasun/category/XA

XA Transaction 이란 여러개의 DBMS, JMS, 또는 그 외의 여러 Resource 간의 Transaction을 보장하는것을 말하고 NonXA Transaction이란 일반적인 하나의 DMBS에서 관리되는 Transaction을 말한다.


XA is a two-phase commit protocol defined by the X/Open DTP group. XA is natively supported by many databases (like Oracle and DB2) and transaction monitors (like CICS and Tuxedo).

1. XA

가. 트랜잭션 처리를 TP-Moniter가 담당한다.
나. 주로 DB 변경 서비스이면서 Distributed Transaction 시 XA로 구성할 것을 권장한다.
다. XA를 사용할 경우 non-XA 보다 10 ~ 25% Overhead가 발생하므로 조회성 업무는 non-XA 사용을 권장한다.
라. 일반적으로 트랜잭션 시작자와 완결자는 하나의 AP 안에 설정되어야 한다.

2. non-XA

가. 트랜잭션 처리를 AP 안에서 User가 설정한다.
나. 주로 DB 조회 서비스나 트랜잭션의 모든 루틴이 하나의 서비스 안에서 작성될 수 있는 것은 non-XA로 구성할 것을 권장한다.
다. non-XA일 경우 트랜잭션 단위는 Service 단위로 해야 한다. 즉 Service내에서 Commit또는 Rollback 처리를 해야 한다.

An XA transaction, in the most general terms, is a "global transaction" that may span multiple resources. A non-XA transaction always involves just one resource.

An XA transaction involves a coordinating transaction manager, with one or more databases (or other resources, like JMS) all involved in a single global transaction. Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes called local transactions).

XA transactions come from the X/Open group specification on distributed, global transactions. JTA includes the X/Open XA spec, in modified form.

Most stuff in the world is non-XA - a Servlet or EJB or plain old JDBC in a Java application talking to a single database. XA gets involved when you want to work with multiple resources - 2 or more databases, a database and a JMS connection, all of those plus maybe a JCA resource - all in a single transaction. In this scenario, you'll have an app server like Websphere or Weblogic or JBoss acting as the Transaction Manager, and your various resources (Oracle, Sybase, IBM MQ JMS, SAP, whatever) acting as transaction resources. Your code can then update/delete/publish/whatever across the many resources. When you say "commit", the results are commited across all of the resources. When you say "rollback", _everything_ is rolled back across all resources.

The Transaction Manager coordinates all of this through a protocol called Two Phase Commit (2PC). This protocol also has to be supported by the individual resources.

In terms of datasources, an XA datasource is a data source that can participate in an XA global transaction. A non-XA datasource generally can't participate in a global transaction (sort of - some people implement what's called a "last participant" optimization that can let you do this for exactly one non-XA item).

For more details - see the JTA pages on java.sun.com. Look at the XAResource and Xid interfaces in JTA. See the X/Open XA Distributed Transaction specification. Do a google source on "Java JTA XA transaction".

- 출처 : http://www.theserverside.com/discussions/thread.tss?thread_id=21385

'⑨ 직무역량강화 > Transaction' 카테고리의 다른 글

[Transaction] JAVA Transaction Programing  (0) 2012.01.06
Comments