¡Ø Transaction
Processing |
|
Distributed programming¿¡¼ ºÐ»ê°´Ã¼(Distributed
object)´Â business component·Î °³¹ßµÇ¾î Áý´Ï´Ù. ƯÈ÷, Enterprise
JavaBeans´Â ºÐ»ê ¼ºñ½º API¿¡ µ¶¸³ÀûÀÎ Business component¸¦ °³¹ßÇÒ¼ö ÀÖ´Ù´Â
ÀåÁ¡À» °®°í ÀÖ½À´Ï´Ù. Business componentÀÇ business method´Â ¿©·¯
componentÀÇ method·Î½á ±¸¼ºµÇ´Â work flow¸¦ °®°í ÀÖÀ»¼ö°¡ ÀÖ°í, ÀÌ°ÍÀº ÇѳªÀÇ
´ÜÀ§·Î ÁøÇàµÇ¾î Á®¾ß ÇÒ°æ¿ì°¡ ´ëºÎºÐÀÔ´Ï´Ù. work flow¸¦ ó¸®ÇÏ´Â Áß Çϳª¶óµµ ¹®Á¦°¡
»ý±ä´Ù¸é, ÁøÇàµÈ ÀÛ¾÷À» ¹«È¿È ÇÒ¼ö ÀÖ¾î¾ß °ÚÁÒ. ÀÌ·¯ÇÑ »óȲ¿¡¼ TransactionÀÌ ÇÊ¿äÇÑ
°ÍÀÔ´Ï´Ù. °á±¹ TransationÀ̶ó´Â °ÍÀº all-or-nothing ¼ºÁúÀ»
°®´Â °ÍÀÌÁÒ. work flow¸¦ ±¸¼ºÇÏ´Â ÇϳªÇϳªÀÇ jobµéÀÌ ¸ðµÎ ÁøÇàµÇ°Å³ª, ¾Æ´Ï¸é ¸ðµÎ ¹«È¿È
Çϰųª ÇØ¾ß ÇÑ´Ù´Â °ÍÀÌÁÒ.
|
1. ACID
Properties |
|
1. Atomic : TransactionÀ» ±¸¼ºÇÏ´Â ¸ðµç ÀÛ¾÷ÀÌ
¸ðµÎ ¼º°øÇϰųª, ¹«È¿È ÇØ¾ß ÇÑ´Ù´Â ¼ºÁú.
Áï, Tx´Â ´õÀÌ»ó ³ª´¼ö ¾ø´Â ÇϳªÀÇ ´ÜÀ§.(atomic unit, all or
nothing property)
2. Consistency :
TransactionÀÌ ¼º°øÀûÀ¸·Î ¿Ï·áµÇ¸é, ¸®¼Ò½ºÀÇ »óŸ¦ ÀÏ°ü¼ºÀÖ°Ô º¸ÀåÇØ¾ß ÇÑ´Ù´Â ¼ºÁú.
Intigerityº¸Àå
3. Isolation :
TransactionÁß¿¡ ´Ù¸¥ Trasaction¿¡ ¿µÇâÀ» ¹Þ¾Æ¼´Â ¾ÈµÈ´Ù´Â ¼ºÁú.
4.
Durability : TransactionÀÌ ÀÌ»ó¾øÀÌ ¿Ï·áµÇ¾úÀ»¶§, ÀÛ¾÷ÀÇ °á°ú°¡ ¿µ±¸ÀûÀ¸·Î
ÀúÀåµÇ¾Æ¾ß ÇÑ´Ù´Â ¼ºÁú.
|
2.
Distributed Transaction |
|
TransactionÀº Distributed Application¿¡¼ ºÐ»êµÇ¾î
ÀÖ´Ù. Áï ¼·Î´Ù¸¥ Database¸¦ µ¿½Ã¿¡ ¾÷µ¥ÀÌÆ® ÇØ¾ß ÇÒ °æ¿ìµµ ÀÖ°í, ¼·Î´Ù¸¥ ½Ã½ºÅÛ¿¡ ÀÖ´Â
Distributed objectÀÇ method¸¦ µ¿½Ã¿¡ ó¸®ÇØ¾ß ÇÏ´Â °æ¿ìµµ ¹ß»ýÇÏ°Ô µÇ´Â °ÍÀÌÁÒ.
±×·¡¼, ´ÙÀ½°ú °°ÀÌ Distributed TransactionÀ» Á¤ÀÇ ÇÒ¼ö ÀÖ½À´Ï´Ù.
Transactions in heterogeneous distributed systems
are called distributed tracsaction.
|
|
Distributed TransactionÀ» ÀÌÇØÇϱâ À§Çؼ Transaction
ParticipantÀÇ °¢°¢¿¡ ´ëÇØ ¸ÕÀú ¼³¸íÇÏ°Ú½À´Ï´Ù.
Reousrce Manager : Transaction resource(RDBMS)¿¡ ´ëÇÑ
managementÀÇ Ã¥ÀÓÀ» Áø´Ù.
ex) database server, messaging queuing systems.
cf) Resource Adapter : application component°¡ resource manager¿¡
connectÇϱâ À§ÇØ »ç¿ëÇÏ´Â JDBC driver¿Í °°Àº °Í.
Transaction Manager : transactionÀÇ begin, commit,
rollbakÀ» Ã¥ÀÓÁö°í, ºÐ»êµÈ Resource manager¿¡ ´ëÇÑ "Two phase
commit" protocol¿¡ ´ëÇÑ Ã¥À»À» Áø´Ù.
A TM uses the XA interface to interact with the RMs.
Tx Application : Transaction Manager¿¡¼ Á¦°øÇÏ´Â
Distributed Tx¸¦ »ç¿ëÇÏ´Â Appllication, EJB component, web
component¸¦ ¸»ÇÑ´Ù.
|
|
¡ß The interface of X/Open Distributed
Transaction Processing
- XA interface : DTPȯ°æ¿¡¼ TM°ú RM»çÀÌÀÇ API
- TX interface : DTPȯ°æ¿¡¼ TM°ú Tx application°£ÀÇ API
|
3. Two-Phase
Commit |
|
Distributed Tx´Â "Two phase commit"À» Áö¿øÇØ¾ß Çϴµ¥,
ÀÌ°ÍÀº Transaction ManagerÀÇ Ã¥ÀÓÀÌÁö¸¸, Resouse Managerµµ
Transaction ManagerÀÇ "Two phase commit" protocol
message¿¡ ´ëÀÀÇÒ¼ö ÀÖ¾î¾ß °ÚÁÒ. Áï Two phase commitÀº TM°ú
RM¿¡ ÀÇÇØ ºÐ»ê TxÀÇ atomicity¸¦ º¸ÀåÇϱâÀ§ÇØ ½ÇÇàµÇ¾îÁø´Ù. ´ÙÀ½ sequence¸¦
ÂüÁ¶Çϼ¼¿ä.
Two-Phase Commit
protocol
|
4.
Transaction Models |
|
|
|
¡ß Flat Tx : À§ÀÇ ±×¸²¿¡¼ Bean-2ÀÇ method-B()´Â
Bean-1ÀÇ method-A()¿¡¼ »ý¼ºµÈ Tx1¿¡ µ¿ÂüÇÏ°Ô µÈ´Ù. Áï, »õ·Î¿î Tx¸¦ »ý¼ºÇÏÁö
¾Ê´Â´Ù.(EJB¿¡¼ CMPÀÇ Tx AttributeÁß Required ¼ºÁú)
|
|
¡ß Nested Tx : À§ÀÇ ±×¸²¿¡¼ Bean-2ÀÇ method-B()´Â
Bean-1ÀÇ methodA()¿¡¼ »ý¼ºµÈ Tx1¿¡ µ¿ÂüÇÏÁö ¾Ê°í, »õ·Î¿î Tx2¸¦ »ý»óÇÑ´Ù.
(EJB¿¡¼ CMPÀÇ Tx AttributeÁß RequiredNew ¼ºÁú)
Tx1ÀÇ commitÀº Tx2ÀÇ fail¿¡ ¿µÇâÀ» ¹ÞÁö ¾Ê´Â´Ù. ±×¸®°í,
Tx1ÀÇ rollbackÀº Tx2¸¦ rollbackÇÑ´Ù.
|